该方法记录了Apollo数据中心改动的日志,具体Apollo配置中心的搭建请参考网上步骤,本人没有搭建过,不是很清楚。
Java代码:
@Configuration
@Slf4j
public class LogApolloConfig {@ApolloConfigprivate Config config;@ApolloConfigChangeListenerprivate void configChangeListener(ConfigChangeEvent changeEvent) {printLog();}@PostConstructprivate void printLog() {config.getPropertyNames().forEach(key -> log.info("apollo配置数据中心key#{},value#{}", key, config.getProperty(key, "")));}
}