Skip to content

Instantly share code, notes, and snippets.

View jdimeo's full-sized avatar

John Dimeo jdimeo

  • Compassion International
  • Charlottesville, Virginia, US
View GitHub Profile
@amr
amr / ConfigurationLoader.java
Last active November 11, 2023 18:43
Java simple YAML/JSON/Properties configuration mechanism with environment variable substitution/interpolation
public class ConfigurationLoader {
private final ObjectMapper objectMapper;
private final StringSubstitutor stringSubstitutor;
ConfigurationLoader() {
this.objectMapper = new ObjectMapper(new YAMLFactory());
this.stringSubstitutor =
new StringSubstitutor(StringLookupFactory.INSTANCE.environmentVariableStringLookup());
}