In 8.0, I'll be adding the concept of a default system configuration.  One of the annoyances of setting up the Juneau REST resources to work with Spring Boot is that you have to manually set the "juneau.configFile" system property so that our servlets know where to look for configuration.  With a default system configuration, this requirement goes away.

Being added is a Config.getSystemDefault() static method that returns the system default configuration.

If "juneau.configFile" is set, it will continue to look for a configuration file with that name in either the home directory or classpath.  If not, then it will look for the following:

  • In the home directory:
    • <jar-name>.cfg
    • Any files that end with .cfg in the JVM home directory.
  • In the classpath (as part of the jar):
    • <jar-name>.cfg
    • juneau.cfg
    • default.cfg

Note that by placing it in your jar, you gain having everything packaged as a single uber-jar, but lose persistence (since it's not writeable).

Also being added:

  • ConfigClasspathStore - A ConfigStore for reading configs from the context classpath.  Note that this is a read-only store.
  • ConfigStore.exists(name) - New method on interface for checking for the existence of a configuration.

Your REST servlets can refer to the system default configuration with the special keyword "SYSTEM_DEFAULT".

For example:

// 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}")


There is a corresponding Config.setSystemDefault(Config) for overriding the system default configuration.   

  • No labels