nacos动态刷新配置

1.使用@Value +@RefreshScope

2.使用@RefreshScope​​ + ​​@ConfigurationProperties

@Data
@Component
​@RefreshScope
@ConfigurationProperties(prefix ="pattern")
public class PatternProperties {
    private String dateformat;//这里prefix会和dateformat自动进行拼接
}

 

posted @ 2022-10-31 11:40  流浪的外星人  阅读(129)  评论(0)    收藏  举报