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).
Disconnected from the target VM, address: ‘127.0.0.1:50440’, transport: ‘socket’
Process finished with exit code 1
解决办法:
①解决办法是重新clean——compile——package
②检查你的数据源是否能连接上,如果使用的配置中心,检查你的启动参数中的配置中心的URL地址是否正确(数据源环境太多的话,重点检查此项)
③在Spring boot的启动引导类上增加@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}),阻止Spring boot自动注入dataSource

本文详细解析了在SpringBoot中遇到的DataSource配置失败问题,包括未能指定'url'属性和无法确定合适的驱动类等常见错误。提供了具体步骤来解决这些问题,如重新编译项目、检查数据源连接和启动参数、以及如何阻止SpringBoot自动注入dataSource。
24万+

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



