nacos-config获取不到服务配置的的踩坑过程

坑:

nacos配置的耶没问题丫!
远程的配置的格式都是对的丫!
后端的application.yml也给注释掉了丫!
后端的bootstrap.yml也配置的对丫!
在本地配置就可以跑,配置放到远程nacso中就不行了!
怎么报我没连上数据源,等等一些没有获取到配置的错误!
为什么:
报错如下:没有获取到配置信息。。。。。。。。。。


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.6.RELEASE)
***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
	If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
	If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

Disconnected from the target VM, address: '127.0.0.1:59088', transport: 'socket'

Process finished with exit code 1

问题原因:配置data id 没有配置对
配置文件的的优先级以及每一个配置文件的的作用域
原因说明
在这里插入图片描述
配置文件的优先级:

bootstrap.properties -> bootstrap.yml -> application.properties -> application.yml

application 作用域在于 当前应用有效
bootstrap 系统级别的配置有效(一般采用远程配置的时候才会用到)

解决方法:删除 application.yml
或者重命名 (命名规则就是让系统获取不到他是个配置文件)
只保留:bootstrap .yml
在这里插入图片描述
在这里插入图片描述

再次运行代码吧!兄弟们

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SteveCode.

永远年轻,永远热泪盈眶

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值