首先声明一下,此项目是copy我之前写的另一个项目,因为在项目基础上需要一些修改所以先copy一份,原项目启动时并不存在这个问题。
所以问题产生原因可推测一二。
报错提示:
***************************
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).
解决方法很简单:
将:
@SpringBootApplication
改成:
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
SpringBoot DataSource配置失败解决方案
本文详细解析了在SpringBoot项目中遇到的DataSource配置失败问题,主要原因是未能正确指定URL属性和确定合适的驱动类。文章提供了简单有效的解决方法,通过排除DataSourceAutoConfiguration类来避免自动配置冲突。
2187

被折叠的 条评论
为什么被折叠?



