I think https://github.com/typesafehub/config is exactly what you are looking for. The format is called HOCON for Human-Optimized Config Object Notation and it a super-set of JSON.
Examples of HOCON:
HOCON that is also valid JSON:
{
"foo" : {
"bar" : 10,
"baz" : 12
}
}
HOCON also supports standard properties format, so the following is valid as well:
foo.bar=10
foo.baz=12
One of the features I find very useful is inheritance, this allows you to layer configurations. For instance a library would have a reference.conf
, and the application using the library would have an application.conf
. The settings in the application.conf
will override the defaults in reference.conf
.
Standard Behavior for loading configs:
The convenience method ConfigFactory.load() loads the following
(first-listed are higher priority):
- system properties application.conf (all resources on classpath with
this name)
- application.json (all resources on classpath with this
name)
- application.properties (all resources on classpath with this
name)
- reference.conf (all resources on classpath with this name)