首页 > 解决方案 > 无法加载驱动程序类:org.postgresql.Driver Spring Boot Parent 2.3.0

问题描述

这是我的 pom.xml

https://maven.apache.org/xsd/maven-4.0.0.xsd">4.0.0 org.springframework.boot spring-boot-starter-parent 2.2.4.RELEASE</version> 2.3.0.RELEASE </version> --> 2.3.0.RELEASE com.cab.booking cab-booking 0.0.1-SNAPSHOT cab-booking 出租车预订平台

<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

这是我的 application.properties 文件

在此处输入图像描述

尝试使用 postgresql 版本 42.2.12 但没有运气。

这是错误日志屏幕截图。

在此处输入图像描述

标签: postgresqlspring-bootspring-data-jpa

解决方案


May be this doesn't make sense but I had same problem and it was fixed with this 2 lines:

spring.jpa.hibernate.ddl-auto=create
logging.level.org.hibernate.SQL=debug 

推荐阅读