项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde(代码片段

Posted 晚风

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde(代码片段相关的知识,希望对你有一定的参考价值。

原因是Spring Boot自动配置的时候发现没有配置数据库

1、SpringBootApplication项目解决办法:

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
public class BdservoApplication {
 
	public static void main(String[] args) {
		SpringApplication.run(BdservoApplication.class, args);
	}
}

2、SpringCloudApplication项目解决方案

# spring配置
spring:
  #排除DruidDataSourceAutoConfigure
  autoconfigure:
    exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure

  

以上是关于项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde(代码片段的主要内容,如果未能解决你的问题,请参考以下文章

Springboot项目启动报错Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded d

项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde(代码片段

Spring Boot 2.1.7 启动项目失败,报错: "Failed to configure a DataSource: 'url' attribute is not

springboot启动报错 Failed to configure a DataSource: 'url' attribute is not specified and no emb

SpringBoot运行报错“The Tomcat connector configured to listen on port 80 failed to start.“

rabbitMQ-server控制台安装报错启动失败,黑窗口一闪即过Applying plugin configuration to rabbit .. failed.