The bean 'nacosRefreshProperties
2021-02-02 本文已影响0人
索性流年
完整报错信息
The bean 'nacosRefreshProperties', defined in class path resource [com/alibaba/cloud/nacos/NacosConfigAutoConfiguration.class], could not be registered. A bean with that name has already been defined in URL [jar:file:/Users/suoxingliunian/.m2/repository/com/alibaba/cloud/spring-cloud-starter-alibaba-nacos-config/2.2.1.RELEASE/spring-cloud-starter-alibaba-nacos-config-2.2.1.RELEASE.jar!/com/alibaba/cloud/nacos/refresh/NacosRefreshProperties.class] and overriding is disabled.
报错原因
- iOC 容器中找不大nacosRefreshProperties bean 对象
解决方法
- 可能是扫包问题,将这个 bean 加入扫包即可
个人解决方法
- 新创建 config 包
- 创建任意 .class 文件 添加注解
@Configuration
@ComponentScan("org.springframework.boot.actuate.autoconfigure.metrics")