原因是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