{title:'Overview', updated:'9.0.0'}

The juneau-config library contains a powerful API for creating and using INI-style config files.

##### Example configuration file:

| # A set of entries | [Section1] | | # An integer | key1 = 1 | | # A boolean | key2 = true | | # An array | key3 = 1,2,3 | | # A POJO | key4 = http://bar

Config files are accessed through the {@link oaj.config.Config} class which are created through the {@link oaj.config.Config.Builder} class. Builder creator methods are provided on the Config class:

| // Create a Config object | Config config = Config.create().name("MyConfig.cfg").build(); | | // Shortcut | Config config = Config.create("MyConfig.cfg").build();

Once instantiated, reading values from the config are simple:

| // Read values from section #1 | int key1 = config.get("Section1/key1").asInteger().orElse(-1); | boolean key2 = config.get("Section1/key2").asBoolean().orElse(false); | int[] key3 = config.get("Section1/key3").as(int[].class).orElse(null); | URL key4 = config.get("Section1/key4").as(URL.class).orElse(null);

The config language may look simple but it is a very powerful feature with many capabilities including:

- Support for storing and retrieving any of the following data types:
  - Primitives
  - POJOs
  - Beans
  - Arrays, Maps, and Collections of anything
  - Binary data
- Transactional modifications with commit/rollback capabilities.
- A listener API.
- Filesystem watcher integration allowing changes on the file system to be reflected in real-time.
- Modifications through the Config class (e.g. add/remove/modify sections and keys, add/remove comments and whitespace, etc...) DO NOT cause loss of formatting in the file.
  All existing whitespace and comments are preserved for you!
- Value encoding for added security.
- Support for SVL variables.
- Directly populate beans from config sections.
- Accessing config sections through Java interface proxies.
- An extensible storage API allows you to write your own config storage (e.g. storage in databases or the cloud).