Skip to content

Configuration Options

asoltesz edited this page Aug 24, 2018 · 9 revisions

Configuration method

SpringLoaded can be configured in two ways, through a system property or via a properties file.

Configuring via system property

java -Dspringloaded=XXX -javaagent:pathto/springloaded.jar -noverify MyCode

XXX should be a semicolon separated list of either individual directives or key=value pairs. For example:

-Dspringloaded=verbose;explain;profile=grails

Configuring via properties file

tbd

Configuration options

Supported directives in the "springloaded" system property:

Verbose logging

verbose - verbose causes SpringLoaded to produce java.util.Logging output which goes into great detail on the reloading process, for example: what types is it processing? when does the filesystem watcher notice class file changes?

Explanations about classes reloading decisions

explain - produces some explanation as to why springloaded is making certain decisions. For example when SpringLoaded fails to make your type reloadable and you need to know why. Is it because you used a package name it considers infrastructure and deliberately doesn't make reloadable (like org.springframework)? Explain mode will tell you that.

Caching reloading information

caching - during the first startup springloaded will store information in a cache folder to speed up later restarts. The default cache dir is <userhome>/.slcache.

Supported key/value pairs:

cacheDir=XXXX - overrides the default cache directory. e.g. cacheDir=/tmp

Plugins for custom reloading mechanisms

plugins=XXXX - a comma separated list of plugins for SpringLoaded to add to the build in set. New plugins enable reloading to play nicely with other frameworks/libraries. e.g. plugins=org.foo.MyPlugin,org.bar.MyOtherPlugin

Profiles

profile=grails - A profile represents a particular configuration of SpringLoaded options, basically a shorthand for specifying all those options individually. The grails profile turns on the options caching and plugins=org.springsource.loaded.SystemPropertyConfiguredIsReloadableTypePlugin. The default cache directory will be <userhome>/.grails unless the additional option cacheDir is specified.

Watching JARs

The watchJars property makes it possible to reload changed classes packaged into JAR files.

For example:

-Dspringloaded=watchJars=foo.jar:bar.jar

This will cause classes loaded from foo.jar and bar.jar to be considered reloadable and those jars will be watched. If the timestamps of the classes being watched within those jars changes, they will be reloaded. Note jars are not fully qualified paths.

Path remapping

Spring Loaded has had a rebasepaths option for, this allows it to load from location X but watch location Y for changes. Maybe it can help here, maybe not. Something like:

-Dspringloaded=rebasePaths=/a/b/c=/d/e/f

Now when things are loaded /a/b/c/com/foo/MyClass.class, it will watch the file at /d/e/f/com/foo/MyClass.class. Multiple path mappings can be passed (comma separated).