matteobaccan/owner

Custom Loader (example : from a Database)

Closed this issue · 3 comments

The only way I know of is to do a public class DBLoader implements Loader and

@Config.Sources({ 
	"db:",
	"classpath:config/common/application.properties"
})
    public boolean accept(URI uri) {
        try {
            return uri.getScheme().equals("db") ;
        } catch (Exception ex) {
            return false;
        }
    }

	@Override
	public void load(Properties result, URI uri) throws IOException {
		result.putAll(ApplicationConfigurationFlatKVFromDB.getOverriddenAppPros());
	}

There is no way to include a new Loader.
So I had to have the entire source.
Is there any way already available for such requirement ?

There is no way to include a new Loader.

Sure ConfigFactory.registerLoader(Loader)

My bad. Thank you. Let me check. Hope whatever loader is registered last has the highest priority ?

@glakshmeepathi Yes, it should be like that.