Skip navigation links

Package com.typesafe.config

An API for loading and using configuration files, see the project site for more information.

See: Description

Package com.typesafe.config Description

An API for loading and using configuration files, see the project site for more information.

Typically you would load configuration with a static method from ConfigFactory and then use it with methods in the Config interface. Configuration may be in the form of JSON files, Java properties, or HOCON files; you may also build your own configuration in code or from your own file formats.

An application can simply call ConfigFactory.load() and place its configuration in "application.conf" on the classpath. If you use the default configuration from ConfigFactory.load() there's no need to pass a configuration to your libraries and frameworks, as long as they all default to this same default, which they should.
Example application code: Java and Scala.
Showing a couple of more special-purpose features, a more complex example: Java and Scala.

A library or framework should ship a file "reference.conf" in its jar, and allow an application to pass in a Config to be used for the library. If no Config is provided, call ConfigFactory.load() to get the default one. Typically a library might offer two constructors, one with a Config parameter and one which uses ConfigFactory.load().
Example library code: Java and Scala.

Check out the full examples directory on GitHub.

What else to read:

Skip navigation links