在这之前都好,启动springboot时出现:
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2019-04-03 23:12:23.921 ERROR 34468 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Cannot determine embedded database driver class for database type NONE
Action:
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).
这个问题很久之前就遇到过了,原因是我没有导入mysql的驱动,于是去maven依赖看了看,很明显,不是依赖的问题,瞬间懵逼,开始不停的百度,但遗憾的是,无非就是缺少jar包或者是pom里面多引入了数据库相关的包,完全和我的情况不搭边,
绝望之余,黄天不负有心人,看到了一大佬的文章(https://blog.csdn.net/mzh1992/article/details/53931267),拯救了我,原来是我的配置文件有问题
这是报错的yml文件:
server:
port: 80
spring:
datasource:
type:com.alibaba.druid.pool.DruidDataSource
url:jdbc:mysql://localhost:3306/myblog?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true
username:root
password:'*123456'
driver-class-name:com.mysql.jdbc.Driver
thymeleaf:
prefix: classpath:/templates/
check-template-location: true
suffix: .html
encoding: utf8
cache: false
mvc:
static-path-pattern: /**
mybatis:
mapper-locations:classpath:mapper/*.xml
type-aliases-package:monsterCry.blog.model
这是不报错的yml文件
server:
port: 80
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
url:jdbc: mysql://localhost:3306/myblog?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true
username: root
password: '*123456'
driver-class-name: com.mysql.jdbc.Driver
thymeleaf:
prefix: classpath:/templates/
check-template-location: true
suffix: .html
encoding: utf8
cache: false
mvc:
static-path-pattern: /**
mybatis:
mapper-locations:classpath:mapper/*.xml
type-aliases-package:monsterCry.blog.model
乍一看是没有什么区别的,细看你会发现
多了空格。搞半天原来是空格惹的祸,令人哭笑不得,另外我发现,在同一目录的几个子项目必须格式一致,不然会解析错误。
最后我想说,这yml文件,大家还是弄个插件编写吧,不然会崩溃的。