spring-boot项目无法启动

问题:

网上找的一个开源项目,启动时报错:

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

分析:

很明显是无法连接数据库的问题。检查连接配置信息,连接,驱动,数据库名,密码均没有问题。

解决:

springboot数据库配置,一般有几种环境:

application-dev.properties 开发环境
application-prod.properties 运行环境
application-test.properties 测试环境

找到你项目中使用的是哪一种。一般在application.yml中配置使用的哪一个配置文件。

我项目中只有一个开发环境的配置,但application.yml中确配了一个测试环境,自然找不到数据库配置文件。

打开:application.yml

配置信息如下:

猜你喜欢

转载自blog.csdn.net/dachao_com/article/details/112799108