springBoot 报错找不到数据库连接
报错记录
APPLICATION FAILED TO START
Description:
Failed to auto-configure a DataSource: ‘spring.datasource.url’ is not specified and no embedded datasource could be auto-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).
错误原因:
当前springBoot项目引入数据库连接jar包,但是没有配置数据连接属性。
解决办法:
1.如果不需要连接数据库,将连接数据库的jar删除,重新启动即可。
2.如果父项目带的,本项目不用,排除即可
@SpringBootApplication(exclude = {
DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class,
HibernateJpaAutoConfiguration.class })
public class AppXxlSso {
public static void main(String[] args) {
SpringApplication.run(AppXxlSso.class, args);
}
}