当前位置:Gxlcms > 数据库问题 > spring boot 启动报错:Cannot determine embedded database driver class for database type NONE

spring boot 启动报错:Cannot determine embedded database driver class for database type NONE

时间:2021-07-01 10:21:17 帮助过:11人阅读

错误原因:spring boot默认会加载org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration类,DataSourceAutoConfiguration类使用了@Configuration注解向spring注入了dataSource bean。因为工程中没有关于dataSource相关的配置信息,当spring创建dataSource bean因缺少相关的信息就会报错。

解决办法:第一种:在Application类上增加@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}),阻止spring boot自动注入dataSource bean

     第二种:增加数据库配置相关信息

 技术分享图片

 

springboot之freemarker:

创建springboot项目,在pom中添加了freemarker的jar包,

技术分享图片

 

在controller层写好相关代码并且把信息传到指定的.ftl文件中,

技术分享图片

 

在.ftl中把信息取出来

技术分享图片

启动,运行正常!

技术分享图片

 

spring boot 启动报错:Cannot determine embedded database driver class for database type NONE

标签:ati   term   相关   关于   信息   添加   解决办法   class   自动   

人气教程排行