有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java SpringBoot类路径maven依赖

我已经在我的^{中添加了这个postgres依赖项:

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

我正在使用mvn spring-boot:run启动我的服务。我收到了这个错误信息:

Cannot load driver class: "org.postgresql.Driver"

我在generaed jar文件中查看了BOOT-INF\lib\

enter image description here

我的application.yml

spring:
  jpa:
    generate-ddl: false
    show-sql: true
    properties:
      hibernate:
        format_sql: true
        jdbc:
          lob:
            non_contextual_creation: true

  liquibase: 
    enabled: false

  profiles:
    active: 'local'

还有我的application-local.properties

spring.datasource.url: "jdbc:postgresql://host:port/db"
spring.datasource.username: "username"
spring.datasource.password: "password"
spring.datasource.driverClassName: "org.postgresql.Driver"

共 (0) 个答案