启动SpringBoot报Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified 。。。。

今天在启动SpringBoot的项目的时候,启动没起来,大概是这个样子的:上图

 上面报错的信息很显是项目添加了数据库必要的组件,所以auto-configured会去加载数据源配置信息,因为我的项目压根就没有

配置数据源,所以就没有启动起来。

那么:我们怎么让项目跑起来了:废话不多说

解决方案:在启动类的@EnableAutoConfiguration或@SpringBootApplication后添加(exclude = {DataSourceAutoConfiguration.class}),排除此类的auto-configured。意思就是绕开数据源配置信息,启动以后就可以正常运行。

           

 

好了:上面的就是解决方法

来启动时试试

启动很流畅,解决了

发布了26 篇原创文章 · 获赞 6 · 访问量 710

猜你喜欢

转载自blog.csdn.net/sdgames/article/details/104110292