欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > 名人名企 > 记录SpringBoot启动报错解决

记录SpringBoot启动报错解决

2025/2/22 2:09:33 来源:https://blog.csdn.net/qq_40896997/article/details/139832862  浏览:    关键词:记录SpringBoot启动报错解决

记录SpringBoot启动报错解决

报错现场

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

解决方式

  1. 如果你不需要数据源配置:添加 exclude = {DataSourceAutoConfiguration.class}​,排除springboot启动时的自动加载,原因是你添加了jdbc依赖导致springboot去自动装载配置。

  2. 如果需要数据源配置:

    1. resource目录未正确识别,导致application.yml或者application.propertis未正确加载,将目录正确添加类型既可。

    image

    1. 查看打包好的编译的target,首先需要确认target中的dataSource配置是否正确,如果没有那么就看是不是pom.xml文件导致<packaging>pom</packaging>​,将该条信息删除,重新 mvn install​。
	如果您的项目的<packaging>配置为pom,那么这意味着您的项目是一个父项目(Parent Project),而不是一个可执行的JAR或WAR项目。父项目通常用于管理多个子项目的共同依赖和配置。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词