Created: 2012-03-23 16:46
Updated: 2016-08-25 02:34
License: apache-2.0


Fig is a simple configuartion library for the JVM.


  • No static methods
  • Pluggable
  • No types
  • Stupid simple
  • Immutability
  • Scala support

Using Fig

Fig is really easy to use. I promise.

Let's use Fig with a Java property file.


Now, in Java, you can get your properties.

Config config = new AutoLoader().getConfig(new URI("file:///tmp/"));
System.out.println("hello " + config.get("hello"));

Scala Implicits

Fig also has an implicit to make life easier for Scala users.

import fig.scala.conversions.ConfigConversions._
val config: Config = new URI("file:///tmp/")
println("hello " + config.get("hello"));

Command Line Execution

Fig also provides an easy way to execute programs from the CLI using config (instead of CLI arguments).

Let's create another Java property file.


The main-class allows us to execute the MyConfigPrinter.

./bin/ --config-path=file:///tmp/

It really is that simple!

Example Project

Fig has an example project called "fig-example", which demonstrates how to use Fig with the script.

Follow these instructions to try things out.

git clone git://
cd fig
mvn clean package
cd fig-example/target
cd fig-example
./bin/ --config-path=file://`pwd`/config/

This will execute a little Java class that prints the configuration in


Fig comes with a lot of FileSystems and ConfigDeserializers out of the box, but you can always extend Fig to use your own config system by using the following Java properties.


Now, AutoLoader will support URIs with an HTTP or HDFS scheme (http://.. or hdfs://..) and YAML config files (*.yaml).

new AutoLoader().getConfig(new URI("http://localhost/my-config.yaml"));

How great is that?

Rules of the Game

Since configuration is often a core and pervasive part of an API, Fig makes the following guarantees.

  1. Fig uses semantic versioning (, and will never make backwards incompatible changes without bumping the major version (*.0.0).
  2. Fig's core library (fig-core) will never have any dependencies.
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more