The Configuration Foundation (Confound) library provides a lightweight yet powerful model for accessing various types of application configuration facilities via Csar.

Quick Start

System Properties and Environment Variables

1. Include Confound Dependency

Include the latest Confound dependency from Maven. To support system properties and environment variables, simply add io.confound:confound:x.x.x to your POM.
pom.xml
<project>
  …
  <dependencies>
    …
    <dependency>
      <groupId>io.confound</groupId>
      <artifactId>confound</artifactId>
      <version>x.x.x</version>
    </dependency>
  </dependencies>
</project>

2. Acquire a Configuration

Acquire a Configuration instance via Confound to gain access to configured parameters. You can also implement the mixin interface Confounded to bring quick and easy configuration to the entire class hierarchy.
MyClass.java
public class MyClass {
  …

    final Configuration config = Confound.getConfiguration();
  …

3. Access Configured Parameters

Access parameters as required. By default Confound will automatically discover the configured parameter from any of the following sources:
  • A system property named foo.bar, set for example using -Dfoo.bar=5.
  • An environment variable named FOO_BAR, set for example using SET FOO=5 in the shell.
MyClass.java
public class MyClass {
  …

    final Configuration config = Confound.getConfiguration();
    final int fooBar = config.getInt("foo.bar");
  …