Blog from December, 2018

Support for import statements in configuration files has just been added:

This is still a work-in-progress.  The most difficult aspect was correctly handling listener events for changes made in imported configurations, including changes due to dynamically added or removed import statements.  I'm still not certain I've got all the concurrency aspects worked out correctly yet and there's still more testing to be done.  

More information can be found in the docs:

Source javadoc tag

I've added a Javadoc taglet for quickly linking to source code on GitHub:  "{@source}" or "{@source label}"

It can be added to class-level javadocs like so:

Based on the file location in the source tree, it will calculate the GitHub link:

I think this will be particularly useful if you want to provide source links in example code javadocs.

Spring Boot Integration

Hi all,

I've made some modifications to the work that Marcelo contributed for the Spring Boot integration.  I still consider this in flux though and suggestions are welcome.

Here's the updated project layout:

Here's what it looks like to start up a Spring app with Juneau Examples REST resources:

Another option is to add the @JuneauRest annotation on your configuration bean method:

The root resource will be initialized with the SpringRestResourceResolver which allows for child resources to be defined as injectable Spring beans.

The app can be launched from Eclipse using the juneau-examples-rest-springboot.launch file.  It will bring up the REST examples on port 5000.

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
// Use system property if set or the system default if not.

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