Configuration / Startup Options
Startup options for Java applications are typically given as System properties. To avoid duplicate maintenance and errors, all System properties are stored on a central Web Server. For development environment, a different Web Server is used, than for production (websvcpro).
This configuration is already available, when common-dependencies are in the list of dependencies (should be always the case).
<dependency>
<groupId>de.gsi.fcc.commons</groupId>
<artifactId>common-dependencies</artifactId>
<version>17.0.0</version>
</dependency>
Then, the first line of code in the main method should load the application specific system properties. For this purpose, several methods exist, e.g. load by filename:
PropertyConfig.loadPropertiesByFilename("app-parammodi.properties");
Afterwards the default properties should be loaded. If you are using the
GSI Application Base class this is done automatically for you:
PropertyConfig.loadDefaultProperties();
All configuration files are stored centrally in a git repository and are deployed by a spring-cloudconfig-service.
To
make changes,
check out the matching branch for the target environment and then commit and push your changes:
https://git.acc.gsi.de/fcc-applications/common-config
Properties are kept in the order that they are loaded, i.e. properties once loaded are not overwritten. Options additionally specified on the command line for debugging or testing purposes overwrite any option loaded by the Property Config always. Typical order:
- Command line options
- Property Config application specific
- Property Config default
- Any other hardcoded system properties added later (not recommended)
In case of any questions: please contact Raphael
Naming guide
For properties that are group or application specific a naming scheme with common prefix like
group.
or
group.appname.
is recommended, for example:
app.parammodi.sleepDurationBeforeEveryActionSeconds = 1
Additionally use a constant with a common naming convention to allow finding available properties using a grep search.
It is also a good practice to include the unit of the value in the name like
_SECONDS
,
_KB
or
_BYTES
.