Closed yangseal closed 4 years ago
Is it nacos' codes? I have no impression.
You are using springboot or spring cloud or spring mvc
springcloud @Value结合@RefreshScope
Whether the log is printed: "Refresh Nacos config group=%s,dataId=%s,configInfo=%s" or "[{}] [notify-ok] dataId={}, group={}, md5={}, listener={}"
类上面加了@RefreshScope
```
@Value("${useLocalCache:false}")
private volatile boolean useLocalCache;
@RequestMapping("/get")
public boolean get() {
return useLocalCache;
}
起了一个线程获取值改变
`@PostConstruct
public void init() {
Thread t= new Thread(new Runnable(){
@Override
public void run() {
while(true){
System.out.println("useLocalCache测试-------:"+useLocalCache);
try {
TimeUnit.MILLISECONDS.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
t.setDaemon(true);
t.start();
}`
在nacos配置中修改useLocalCache值,线程值打印无变化,通过http调用get接口,值发生变化,线程打印值如下,打印有问题
![image](https://user-images.githubusercontent.com/15855998/85493389-672a2e80-b609-11ea-9f01-3e2ed4ec3544.png)
首先你有排查日志确定接收到了配置变更的刷新吗?如果有,那这个问题就脱离nacos了,而是spring-cloud的问题了应该
No response from author, close issue
Issue Description
Type: bug report or feature request
Describe what happened (or what feature you want)
Describe what you expected to happen
How to reproduce it (as minimally and precisely as possible)
public static boolean logSwitchOff; //日志开关,默认开启 @Value("${logSwitchOff:true}") public void setLogSwithOff(boolean logSwitchOff) { NacosConfiguration.logSwitchOff = logSwitchOff; }
Tell us your environment
nacos版本1.2.1
Anything else we need to know?