1、配置文件检查
仔细检查nacos上的配置文件格式内容等是否有错误或者格式不正确。
2、服务读取配置是否添加
spring:
cloud:
nacos:
config:
extension-configs:
- data-id: xxx.yaml
group: ${xxx-nacos-group}
refresh: true
3、配置类是否添加相关注解
@Data
@Configuration
@ConfigurationProperties(prefix = "xxx")
注意点
第二点中的配置必须添加在bootstrap.yml中,如果是添加在application.yml中将无法读取到配置。