Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leberkleber/ljcm
Lightweight Java Configuration Management (Small, simple and lightweight java framework to manage configurations)
https://github.com/leberkleber/ljcm
configuration configuration-management java lightweight lightweight-java-framework small
Last synced: 4 months ago
JSON representation
Lightweight Java Configuration Management (Small, simple and lightweight java framework to manage configurations)
- Host: GitHub
- URL: https://github.com/leberkleber/ljcm
- Owner: leberKleber
- License: apache-2.0
- Created: 2018-02-22T17:55:00.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-18T07:39:49.000Z (almost 7 years ago)
- Last Synced: 2024-10-15T03:22:09.517Z (4 months ago)
- Topics: configuration, configuration-management, java, lightweight, lightweight-java-framework, small
- Language: Java
- Homepage:
- Size: 95.7 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/leberKleber/ljcm.svg?branch=master)](https://travis-ci.org/leberKleber/ljcm)
[![codecov.io](https://codecov.io/github/leberKleber/ljcm/coverage.svg?branch=master)](https://codecov.io/github/leberKleber)
[![license](https://img.shields.io/github/license/leberkleber/ljcm.svg)]()
# ljcm
**Lightweight Java Configuration Management**Small, simple and lightweight java framework to manage configurations
## How to use
### 1) Include via Maven
```xmlio.github.leberkleber.ljcm
ljcm-minimal
1.0.1```
### 2) Annotate Configuration-File
```java
public class Configuration {
@Configuration("my.config.key")
private String myConfig;
public String getMyConfig() {
return myConfig;
}
}
```
### 3) Configure ljcm
```java
public static void main(String[] args){
ConfigurationProcessor cp = new ConfigurationProcessorBuilder()
.addConfigurationParsers(Parser.getDefaultParser())
.setConfigurationLoader(
new HierarchicalLoader.Builder()
.addLoader(new EnvironmentVariableLoader())
.addLoader(new PropertiesFileLoader("classpath:/app.properties"))
.addLoader(new PropertiesFileLoader("/etc/myapp/app.properties"))
.build();
).build();
cp.process(Configuration.class);
}
```
## Configuration parser
### Default parser
The "ljcm-minimal-parser" contains a minial set of parsers:
- Boolean / boolean @BooleanParser
- Byte / byte @ByteParser
- Character[] / char[] @CharArrayParser
- Character / char @CharParser
- Double / double @DoubleParser
- Float / float @FloatParser
- Integer / int @IntParser
- Long / long @LongParser
- Short / short @ShortParser
- String @ StringParserAll "minimal-parser" can be loaded via:
```java
Parser.getDefaultParser()
```
### Custom parser
A custom parser must implement the "ConfigurationParser" interface.## Configuration loader
### Default loader
The "ljcm-minimal-loader" contains a minial set of loaders:
- HierarchicalLoader
- EnvironmentVariableLoader
- PropertiesFileLoader## Logging
ljcm uses jul. You can easy use a jul-bridge e.g.:
SLF4J:
```java
import java.util.logging.Logger;
import org.slf4j.bridge.SLF4JBridgeHandler;SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
```