吴裕雄天生自然SPRINGBOOT开发实战处理'spring.datasource.url' is not specified and no embedded datasource could be autoconfigured

错误原因是触发了数据源的自动化配置,然而当前项目其实并不需要数据源。查其根源是依赖方提供的API依赖中引用了一些多余的依赖触发了该自动化配置的加载。

为了解决上面所述的问题,我们可以用两种方法来解决:
1)通过外部依赖的修改来解决:通过与依赖方沟通,在对方提供的API依赖中去掉不必要的依赖;
2)通过禁用指定的自动化配置来避免加载不必要的自动化配置;
下面列举了禁用的方法:

使用了@EnableAutoConfiguration的时候
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})

使用了@SpringBootApplication的时候
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})

使用了@SpringCloudApplication的时候
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) 
@SpringCloudApplication

通过配置文件来设置
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
原文地址:https://www.cnblogs.com/tszr/p/15232691.html