I'm fairly new to Spring Boot so please excuse me if I'm overlooking something simple.
With the Spring Config Server, you are able to specify via .yml files what type of environment repository that you would like to use (native, Git, etc). These environment repositories are included in the third-party dependency. I was wondering if it was possible to add your own environment repository so you can, for example, connect to a database to pick up configuration?
Many thanks in advance!
you certainly can. See spring cloud consul config as an example. The guts is a PropertySource
public class MyPropertySource extends EnumerablePropertySource<MyClient> {
@Override
public Object getProperty(String name) {
return /* your impl */;
}
@Override
public String[] getPropertyNames() {
return /* your impl here */;
}
}
You also need a PropertySourceLocator
, a bootstrap configuration and a META-INF/spring.factories
that points to the bootstrap config`.