'Non-accessible configuration design

Due to design constrains the project I am currently working on won't allow us to write certain set of configuration parameters in plain text file such as properties files (mainly due to security constrains).

Is there any way to conceal this configuration parameters in order for them just to be accessible to the code programmers. A plain Java object is so far my only idea.

Also, it's worth noticing that hard-coding values is not a good solutions for us, given there are many 'sub-applications' that requiere their own configuration. In this point consider some kind of resource bundle but that will still have the original problem.

EDIT: So I came across Jasypt as proposed here, nonetheless I think that for my case saving this in some kind of obfuscated file is sufficient since it is all we need in order to make the user stop tampering with configuration files.



Solution 1:[1]

Use environment variables:

String value = System.getEnv(myKey);

which are defined at the OS via export foo=bar (*nix) or SET foo=bar (windows), or system properties:

String value = System.getProperty(myKey);

which are defined on the java command line, eg java -DmyKey=myValue ...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Glorfindel