首页 > 数据库技术 > 详细

让Springboot启动时不连接数据库

时间:2021-04-28 21:46:45      阅读:38      评论:0      收藏:0      [点我收藏+]

 

写了个简单的Springboot工程,启动时始终会报错:

“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).”

      其意思是:“如果您想要一个嵌入式数据库,请将一个受支持的数据库放到类路径中。如果要从特定概要文件加载数据库设置,则可能需要激活它(当前没有概要文件处于活动状态)。”

       也就是说,项目中没有数据库相关的配置。Springboot在启动时默认会注入数据源,但是系统中又找不到数据库的配置,因此报错。

 

解决:
如果项目确实不需要连接数据库,请在启动类中添加注解 
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})

技术分享图片

 

 


 
问题解决。

 

让Springboot启动时不连接数据库

原文:https://www.cnblogs.com/panchanggui/p/14715032.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!