提交 d1ae1477 编写于 作者: N nobodyiam 提交者: Jason Song

update demo with interestedKeyPrefixes

上级 6a6f50b0
......@@ -28,19 +28,9 @@ public class SpringBootApolloRefreshConfig {
this.refreshScope = refreshScope;
}
@ApolloConfigChangeListener({ConfigConsts.NAMESPACE_APPLICATION, "TEST1.apollo", "application.yaml"})
@ApolloConfigChangeListener(value = {ConfigConsts.NAMESPACE_APPLICATION, "TEST1.apollo", "application.yaml"},
interestedKeyPrefixes = {"redis.cache."})
public void onChange(ConfigChangeEvent changeEvent) {
boolean redisCacheKeysChanged = false;
for (String changedKey : changeEvent.changedKeys()) {
if (changedKey.startsWith("redis.cache")) {
redisCacheKeysChanged = true;
break;
}
}
if (!redisCacheKeysChanged) {
return;
}
logger.info("before refresh {}", sampleRedisConfig.toString());
refreshScope.refresh("sampleRedisConfig");
logger.info("after refresh {}", sampleRedisConfig.toString());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册