我使用SpringBoot和Intellij。我相信我拥有所需的所有依赖关系。尽管如此,我仍然不断地得到PostgreSQL驱动程序没有发现错误。下面是Gradle文件中的依赖项。
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-jersey'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
发布于 2019-03-03 08:42:36
还添加以下依赖项:
compile group: 'org.postgresql', name: 'postgresql', version: '42.1.1'
在gradle.build文件中包含依赖项之后,还在Application.properties文件中包含以下行,以通知应用程序PostgreSQL服务器在哪里,以及访问数据库的凭据是什么
spring.datasource.url= jdbc:postgresql://localhost:5432/dbname spring.datasource.username=postgres spring.datasource.password=xxxxxxxx Spring.jpa.Hibernate.ddl-auto=create
https://stackoverflow.com/questions/54966987
复制相似问题