Spring Cloud有一个引导程序
ApplicationContext,您可以自定义该引导程序并使用它来向中添加属性
Environment。该
spring-cloud-config-client是相当轻巧,比春等没有强制性的依赖。文档在这里。引导程序配置示例:
@Configurationpublic class CustomPropertySourceLocator implements PropertySourceLocator { @Override public PropertySource<?> locate(Environment environment) { return new MapPropertySource("databaseProperties", getPropertiesFromDatabase()); }}具体实施
getPropertiesFromDatabase()取决于您。



