配置错误 dataid问题 启动日志: 使用properties格式的文件: Ignore the empty Nacos configuration and get it based on dataId[xxx-server] & gr
配置错误 dataid问题
启动日志:
使用properties格式的文件:
Ignore the empty Nacos configuration and get it based on dataId[xxx-server] & group[DEFAULT_GROUP]Ignore the empty nacos configuration and get it based on dataId[xxx-server.properties] & group[DEFAULT_GROUP]Ignore the empty nacos configuration and get it based on dataId[xxx-server-dev.properties] & group[DEFAULT_GROUP]
使用yaml文件格式:
Ignore the empty nacos configuration and get it based on dataId[xxx-server] & group[DEFAULT_GROUP]Ignore the empty nacos configuration and get it based on dataId[xxx-server.yaml] & group[DEFAULT_GROUP]Ignore the empty nacos configuration and get it based on dataId[xxx-server-dev.yaml] & group[DEFAULT_GROUP]
官方介绍:
在 Nacos spring cloud 中,dataId
的完整格式如下:
${prefix}-${spring.profiles.active}.${file-extension}
prefix
默认为 spring.application.name
的值,也可以通过配置项 spring.cloud.nacos.config.prefix
来配置。spring.profiles.active
即为当前环境对应的 profile,详情可以参考 Spring Boot文档。 注意:当 spring.profiles.active
为空时,对应的连接符 -
也将不存在,dataId 的拼接格式变成 ${prefix}.${file-extension}
file-exetension
为配置内容的数据格式,可以通过配置项 spring.cloud.nacos.config.file-extension
来配置。目前只支持 properties
和 yaml
类型。踩坑:之前习惯yaml配置文件使用yml后缀,因此在nacos服务器配置时,仍然使用yml。这个错误的!!!
第二种问题:
配置了namespace和group。 如果配置了namespace,需要在配置文件中指定具体的namespace,例如:
上面新增了namespace和group后,发现找不到配置文件。
我们需要钱nacos服务器上进行相关的配置。
我这里未指定命名空间ID.(其实项目中配置文件,namespace的值是空间ID,不是空间名称)
自动生成:
文件配置:
继续启动服务,发现仍然报错。
原因是namespce未使用命名空间ID,修改后,再启动:
因为是轮询,匹配到第三个,项目启动成功!!
来源地址:https://blog.csdn.net/qq_33642970/article/details/129195621
--结束END--
本文标题: Nacos Ignore the empty nacos configuration and get it based on dataId
本文链接: https://www.lsjlt.com/news/396215.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-04-01
2024-04-03
2024-04-03
2024-01-21
2024-01-21
2024-01-21
2024-01-21
2023-12-23
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0