SpringBoot 项目启动报错 ===> 配置数据源失败

错误提示:

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


Process finished with exit code 1

错误翻译:

说明:

配置数据源失败:未指定“url”属性,无法配置嵌入的数据源。

原因:未能确定合适的驱动程序级别

行动:

考虑以下几点:

如果您想要一个嵌入式数据库(H2、HSQL或Derby),请将它放在类路径上。

如果要从特定配置文件加载数据库设置,则可能需要激活它(当前没有激活的配置文件)。

进程已完成,退出代码为1

解决方案:

Spring boot 的启动引导类上增加属性 @SpringBootApplication(exclude = DataSourceAutoConfiguration.class),即可阻止Spring boot自动注入dataSource

注:以上内容仅提供参考和交流,请勿用于商业用途,如有侵权联系本人删除!

上一篇:JavaScript中forEach与each


下一篇:JPA+H2内嵌数据库