apollo配置动态更新
简单配置
使用@Value注解的配置会自动刷新配置
复杂对象
@Component("systemConfig")@ConfigurationProperties(prefix = "cword")
@RefreshScope
@EnableApolloConfig("cword")
public class SystemConfig {
private Resource filePath;
private Resource tempFilePath;
@Autowired
private org.springframework.cloud.context.scope.refresh.RefreshScope refreshScope;
@ApolloConfigChangeListener("cword")
private void configChange(ConfigChangeEvent changeEvent){
refreshScope.refresh("systemConfig");
}
}
以上是 apollo配置动态更新 的全部内容, 来源链接: utcz.com/z/512615.html