Skip to content

ccidral/commons-conf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Commons Configuration

Usage:

import commons.conf.Configuration;
import commons.conf.ConfigurationLoader;
import commons.conf.MultiSourceConfigurationLoader;
import commons.conf.sources.JndiProperties;
import commons.conf.sources.PropertiesFile;
import commons.conf.sources.PropertiesResourceFile;

import javax.naming.Context;
import javax.naming.InitialContext;

Context jndiContext = new InitialContext();

ConfigurationLoader configurationLoader = new MultiSourceConfigurationLoader(
    new PropertiesResourceFile("/myapp.properties"),
    new JndiProperties("my-config", jndiContext),
    new PropertiesFile("/programs/myapp/conf/myapp.properties")
);

Configuration configuration = configurationLoader.loadConfiguration();

String foo = configuration.get("foo");
int bar = configuration.getInt("bar");

About

Configuration loader

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages