@NacosConfigListener(dataId = "config") private void onMessage(String msg){<!-- --> System.out.println("配置變動"+msg); } } 配置引數能夠正常注入進去,但是配置改動的監聽沒有監聽到。後來和之前學習寫的demo做對比,發現了如果我把這個監聽的函式修飾字使用private則會導致監聽無法生效,改為public則...
public class SystemConfig { @NacosValue(value = "${market_data_collector.ip:127.0.0.1}",autoRefreshed = true) private String marketDataCollectorIP; @NacosValue(value = "${market_data_collector.port:12001}",autoRefreshed = true) private int marketDataCollectorPort; @NacosConfigListener(dataId = ...