报错信息如下 Description: No spring.config.import property has been defined Spring 官方给出的解决方案如下 Add a
报错信息如下
Description:
No spring.config.import property has been defined
Spring 官方给出的解决方案如下
Add a spring.config.import=Nacos: property to your configuration.
If configuration is not required add spring.config.import=optional:nacos: instead.
To disable this check, set spring.cloud.nacos.config.import-check.enabled=false.
这里只尝试了第一种解决方案:
首先,2021.0.5版本的 spring cloud 默认不再启用 bootstrap 包,因此应该将配置文件写在 application.yml 中,或手动在 Maven 中导入 bootstrap 包
然后,在 application.yml 中,按照以下方式配置
spring: application: name: XXXX cloud: nacos: server-addr: XX.XX.XX.XX:8848 config: group: XXXX namespace: XXXX# SpringCloud 2021版本之后,需要用以下方式导入nacos的配置文件 config: import: nacos:XXXX.yml
问题解决。
来源地址:https://blog.csdn.net/weixin_44951259/article/details/127929284
--结束END--
本文标题: 解决 Spring Cloud 2021.0.5 版本,使用 nacos 做配置中心,报 No spring.config.import property has been defined 的问题
本文链接: https://www.lsjlt.com/news/408405.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-04-03
2024-04-03
2024-04-01
2024-01-21
2024-01-21
2024-01-21
2024-01-21
2023-12-23
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0