首页 > 编程语言 > 详细

Spring Boot 2.1.7 启动项目失败,报错: "Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured."

时间:2020-02-22 12:09:59      阅读:59      评论:0      收藏:0      [点我收藏+]

一开始按照网上的很多解决办法是:

启动类头部声明@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class}),但是这样会排除掉我自己的数据库配置,

检查了很多地方都没发现问题在哪里,最后自己猜想不论怎么修改application.yml文件,都不生效,是不是因为这个配置文件就没有被加载到?

带着这个想法我就去网上搜了一下问题,有个问题看到了target目录的作用,就去想了一下是不是application.yml文件没有被编译出来到target目录下,

首先查看了正常项目里面target目录下面是有application.yml这个配置文件的,

技术分享图片

接下来是启动报错的项目,发现target目录下并没有这个application.yml:

技术分享图片

 

所以最后将application.yml拷贝到target目录下项目就可以正常启动了!

Spring Boot 2.1.7 启动项目失败,报错: "Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured."

原文:https://www.cnblogs.com/akiradunn/p/12344100.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!