springboot出现Fail to configure a Datasource:‘url’ attribute is not specified and no embedded datasour
运行springboot项目,出现错误
Fail to configure a Datasource:‘url’ attribute is not specified and no embedded datasource could be configured
这个错误主要是引用maven项目中pom.xml文件有
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-start-data-jpg</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
我这边使用的是jpa(java persistent api)操作数据库,这里面有用到jdbc连接,springboot在启动的时候,会自动
去装配文件中查找连接信息,找不到会报错。
我刚刚就是在application.yml中配置出错,忘记写了spring,导致没有读取到数据,在datasource前面多加spring,就正常启动了