This project support for interact with properties file
1. Read properties file
Properties properties = new BaseFileReader()
.read("application.properties");
2. Read YAML file
Properties yamlProperties = new BaseFileReader()
.read("application.yaml");
3. Read properties file with profiles
Properties propertiesAlpha = new MultiFileReader("alpha")
.read("application.properties");
4. Read YAML file with profiles
Properties propertiesAlpha = new MultiFileReader("alpha")
.read("application.yaml");
5. Map properties or YAML file to POJO
ApplicationConfig applicationConfigYaml = new PropertiesMapper()
.reader(new MultiFileReader("alpha"))
.file("application.yaml")
.map(ApplicationConfig.class);
6. Use annotation to map
public class Config {
@Property("n")
private String name;
@Property("a")
private int age;
@Property("m")
private long money = 10;
}
7. Use variable in properties file
app.hello=world
app.hi=${app.hello}
8. Use variable in yaml file
app.hello: world
app.hi: ${app.hello}
Proprties and YAML are using in a lot of framework and application, so we want to create a library support to read .propertes
and YAML
file and map them to POJO
if you want
<dependency>
<groupId>com.tvd12</groupId>
<artifactId>properties-file</artifactId>
<version>1.1.8</version>
</dependency>
http://www.javadoc.io/doc/com.tvd12/properties-file
mvn test
- Touch us on Facebook
- Ask us on stackask.com
- Email to me Dzung
- Apache License, Version 2.0