{new} 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:

  1. If the system property "juneau.configFile" is set, we search for this file in first the home directory and then the classpath.
  2. In the home directory:
    1. <jar-name>.cfg
    2. Any file that end with .cfg. First one matched alphabetically is used.
  3. In the context classpath (i.e. inside the jar itself):
    1. <jar-name>.cfg
    2. juneau.cfg
    3. default.cfg

Later in the section on REST resources, we describe how to associate configurations with REST resources using the {@link oajr.annotation.RestResource#config() @RestResource(config)} annotation. The system default configuration can be referenced with the keyword SYSTEM_DEFAULT like so:

// Always use system default. @RestResource(config="SYSTEM_DEFAULT") // Use system property if set or the system default if not. @RestResource(config="$S{juneau.configFile,SYSTEM_DEFAULT}")