首页 > 解决方案 > 使用 PostgreSQL 字段启动 Spring Boot

问题描述

这是一个简单的 Spring Boot CURD 应用程序。它未能启动。

在 pom.xml 我有: -

        <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <scope>runtime</scope>
    </dependency>

在 pom 中也有更多的体面。

应用程序属性:-

spring.datasource.url=jdbc:postgresql://localhost:5432/mydb
spring.datasource.username=myuser
spring.datasource.password=mypass
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=create

尝试启动应用程序时,出现以下错误:-

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-07-12 15:29:40 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter - 

 ***************************
 APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource:

Property: driverclassname
Value: org.postgresql.Driver
Origin: "driverClassName" from property source "source"
Reason: Failed to load driver class org.postgresql.Driver in either of HikariConfig class loader or Thread context classloader

 Action:

 Update your application's configuration

我很困惑我错过了什么?请告诉我。提前致谢!

标签: postgresqlspring-bootspring-data-jpa

解决方案


推荐阅读