Popularity
4.9
Growing
Activity
0.0
Stable
554
26
116

Programming language: Java
License: Apache License 2.0
Tags: Configuration    
Latest version: v4.4.1

cfg4j alternatives and similar libraries

Based on the "Configuration" category.
Alternatively, view cfg4j alternatives based on common mentions on social networks and blogs.

  • config

    configuration library for JVM languages using HOCON files
  • owner

    5.8 7.7 L4 cfg4j VS owner
    Get rid of the boilerplate code in properties based configuration.
  • Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
  • centraldogma

    Highly-available version-controlled service configuration repository based on Git, ZooKeeper and HTTP/2
  • KAConf

    KickAss Configuration. An annotation-based configuration system for Java and Kotlin
  • Gestalt

    A Java configuration library that allows you to build your configurations from multiple sources, merges them and convert them into an easy-to-use typesafe configuration class. A simple but powerful interface allows you to navigate to a path within your configurations and retrieve a configuration object, list, or a primitive value.
  • dotenv

    A twelve-factor configuration (12factor.net/config) library for Java 8+
  • Configur8

    Nano-library which provides the ability to define typesafe (!) configuration templates for applications.
  • ini4j

    Provides an API for handling Windows' INI files.

Do you think we are missing an alternative of cfg4j or a related project?

Add another 'Configuration' Library

README

Twitter Follow Documentation Examples Maven Central JavaDoc GitHub license Travis

Overview

cfg4j ("configuration for Java") is a configuration library for Java distributed apps (and more).

Features:

  • Open source
  • Easy to use
  • Auto-reloads configuration
  • Powerful configuration mechanisms (interface binding, multi-source support with fallback strategy, merging, ...)
  • Distributed-environment friendly ( caching, support for multiple environments [test, preprod, prod], ...)
  • Reads configuration from: Consul, Git repos (YAML and/or properties), Files, Classpath, ...
  • Modern design
    • Seamless integration with DI containers: Spring, Guice and others
    • Exposes performance metrics by integration with Metrics library
    • Extensible (see the list of plugins below)
    • Heavily tested (99% code coverage)
    • Well documented
    • Java 8+ required

Usage

Read an article about configuration management using cfg4j.

Detailed documentation

Head to the documentation.

Sample apps

Explore the code of the sample apps.

Quick start

Setting up dependency

Gradle

dependencies {
  compile group: "org.cfg4j", name:"cfg4j-core", version: "4.4.1"

  // For Consul integration
  compile group: "org.cfg4j", name:"cfg4j-consul", version: "4.4.1"

  // For git integration
  compile group: "org.cfg4j", name:"cfg4j-git", version: "4.4.1"
}

Maven

<dependencies>
  <dependency>
    <groupId>org.cfg4j</groupId>
    <artifactId>cfg4j-core</artifactId>
    <version>4.4.1</version>
  </dependency>
  <!-- For Consul integration -->
  <dependency> 
    <groupId>org.cfg4j</groupId>
    <artifactId>cfg4j-consul</artifactId>
    <version>4.4.1</version>
  </dependency>
  <!-- For git integration -->
  <dependency>
    <groupId>org.cfg4j</groupId>
    <artifactId>cfg4j-git</artifactId>
    <version>4.4.1</version>
  </dependency>
</dependencies>

Usage

The fastest way to start working with cfg4j is to use a Git repository as a configuration store. To do that follow the steps:

  • Use the following code in your application to connect to sample configuration source: ```java public class Cfg4jPoweredApplication {

// Change this interface to whatever you want public interface SampleConfig { Integer birthYear(); List friends(); URL homepage(); Map grades(); }

public static void main(String... args) { ConfigurationSource source = new GitConfigurationSourceBuilder() .withRepositoryURI("https://github.com/cfg4j/cfg4j-git-sample-config.git") .build();

ConfigurationProvider provider = new ConfigurationProviderBuilder()
  .withConfigurationSource(source)
  .build();

SampleConfig config = configurationProvider.bind("reksio", SampleConfig.class);

// Use it!
System.out.println(config.homepage());

}

}


* Optional steps
    1. Fork the [configuration sample repository](https://github.com/cfg4j/cfg4j-git-sample-config).
    2. Add your configuration to the "*application.properties*" file and commit the changes.
    3. Update the code above to point to your fork.

# License
Licensed under the Apache License, Version 2.0. See LICENSE file.


*Note that all licence references and agreements mentioned in the cfg4j README section above are relevant to that project's source code only.