System Default Config
Each JVM has a system default config. This is a configuration file that serves as the default configuration for the system. It's accessed using the following static methods:
If you do not specify a system default config, one will be automatically searched for. The search is done in the following order:
- If the system property
juneau.configFile
is set, we search for this file in first the home directory and then the classpath. - In the home directory:
.cfg
- Any file that end with
.cfg
. First one matched alphabetically is used. - In the context classpath root package (i.e. inside the jar itself):
.cfg
juneau.cfg
default.cfg
application.cfg
app.cfg
settings.cfg
application.properties
Later in the section on REST resources, we describe how to associate configurations with REST resources using the @Rest(config) annotation.
The system default configuration can be referenced with the keyword SYSTEM_DEFAULT
like so:
// Always use system default.
@Rest(config="SYSTEM_DEFAULT")
// Use system property if set or the system default if not.
@Rest(config="$S{juneau.configFile,SYSTEM_DEFAULT}")
By default, all properties in the system default configuration are automatically set as system properties.
This can be disabled by setting the system property juneau.disableAutoSystemProps
to true
.