spring boot 配置文件后綴的一個坑
Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
spring boot配置文件支持 properties和yml
從yml配置文件拷貝了一個數據源到properties的項目中死活不行一直報這樣的錯
說是跟驅動有關系,但是驅動都有,druid的連接池都有,幾番嘗試無果,
從新創建一個demo試試
用https://start.spring.io創建的
創建的時候,mysql,mybatis,JDBC都勾選上了
直接 maven install ,居然報一樣的錯,因為新建的項目,就把數據庫連接配上
spring.datasource.url = jdbc:mysql://127.0.0.1:3306/ctb spring.datasource.driver-class-name = com.mysql.jdbc.Driver
然后再啟動就不報錯了,恍然大悟,肯定是程序無法識別 以冒號縮進,格式的配置,就把配置文件改成了yml,然后,就沒有然后了,就成功了
spring boot 配置文件后綴導致啟動失敗
錯誤
錯誤原因
springboot 配置文件的格式和內容格式無法匹配(如下圖所示)
解決方案
把配置文件application.properties 改為 application.yml 即可
以上為個人經驗,希望能給大家一個參考,也希望大家多多支持服務器之家。
原文鏈接:https://blog.csdn.net/mzh1992/article/details/53931267