avaje / avaje-config

Application configuration / properties loading for JVM applications
https://avaje.io/config
Apache License 2.0
47 stars 7 forks source link

feat: Add Configuration.Builder load() method to load a file or resource #131

Closed rbygrave closed 3 months ago

rbygrave commented 3 months ago

This then allows programmatic creation of Configuration which include the loading of files or resources like:

var fileSource = new File("./src/test/resources/yaml/minimal.yaml");

var configuration = Configuration.builder()
  .put("myExtraOne", "baz")
  .load(fileSource)          // load from a file
  .load("hi.properties")     // load from a resource
  .build();

With the file extension of .properties or .yaml/.yml used to determine which parser to use to parse and load the content for the file or resource.