Failed to configure a DataSource: 'url' attribute is not specified and no embedded ...

启动SpringCloud框架的其中一个微服务UserService时出现了如下异常

Failed to configure a DataSource: 'url' attribute is not specified and no embedded ...

指定数据库失败,可是我在yml文件中配置了呀

 后面提示应该怎么做,红线的那句话意思是:如果你有数据库配置需要从一个指定的文件中加载,你需要激活它

哎呦,这该不会是yml文件没有加载吧

打开target文件夹,果然里面没有编译好的yml文件

我也不知道怎么弄,最后找了一篇终于解决了问题https://blog.csdn.net/pk694046220/article/details/105038861?utm_medium=distribute.pc_relevant.none-task-blog-baidujs-1

做法是:打开pom文件,将<packaging>pom</packaging>去掉

原因是:把当前工程当做pom依赖,只编译class

原文地址:https://www.cnblogs.com/rachelgarden/p/12969300.html