解决办法:
给bean加个@RefreshScope
即可
import org.springframework.cloud.context.config.annotation.RefreshScope
......
@Service
@RefreshScope
public class XXXService{
@Value("${nacos.config.key}")
private String key;
......
}
解决办法:
给bean加个@RefreshScope
即可
import org.springframework.cloud.context.config.annotation.RefreshScope
......
@Service
@RefreshScope
public class XXXService{
@Value("${nacos.config.key}")
private String key;
......
}