我有一个使用Spring Boot 2.0.3.RELEASE开发的JPA应用程序,连接到PostgreSQL数据库,但在运行应用程序时,我遇到了以下错误信息:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
数据库连接属性:
spring:
datasource:
url: jdbc:postgresql://localhost:5432/testS
username: postgres
password: postgres123
driver-class-name: org.postgresql.Driver
依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
堆栈跟踪:
Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
我该如何解决这个问题?
dataSourceClassName=org.postgresql.ds.PGSimpleDataSource
- user7294900Failed to configure a DataSource: 'url' attribute is not specified
表示您的application.yml
文件根本没有被读取。 - Markus Pscheidt