Config Reader - Simple way to read configuration files
Contents
Key Features
- Reads .properties and .yml files
- Returns configs as a Map<String, String>
- Merges environment and project configs
Environments
- Default config file name is project (project.properties OR project.yml)
- Environment names can be any String value
Limitations
- Empty config files are not handled.
Examples
Read YML files
Map<String, String> properties = new YmlConfig("dev").getConfig();
- Reads
dev.yml
andproject.yml
- Merges both files - environment property is considered to return when duplicate key exists
- Returns the merged configuration as a
Map<String, String>
Map<String, String> properties = new YmlConfig().getConfig();
- Reads and returns
project.yml
Read PROPERTIES files
Map<String, String> properties = new PropertyConfig("dev").getConfig();
- Reads
dev.properties
andproject.properties
- Merges both files - environment property is considered to return when duplicate key exists
- Returns the merged configuration as a
Map<String, String>
Map<String, String> properties = new PropertyConfig().getConfig();
- Reads and returns
project.properties