坑:
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
再次运行代码吧!兄弟们