Hikari:无法配置数据源

时间:2019-12-12 20:41:38

标签: spring-boot gradle hikaricp

我正在使用带有Hikari的Spring-bootstrap连接到postgres数据库。并出现错误:

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

Description:

Failed to configure a DataSource: no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class

我在 gradle 配置中的依赖项是:

dependencies {
    //  notification dependencies 
    implementation 'com.notification.commons:proto-messages:1.0.0-SNAPSHOT'
    // This dependency is found on compile classpath of this component and consumers.
    implementation 'com.google.guava:guava:27.0.1-jre'
    implementation 'org.apache.commons:commons-lang3:3.9'
    //Kafka Dependencies
    implementation 'org.apache.kafka:kafka-streams:2.2.1'
    implementation 'org.apache.kafka:kafka-clients:2.2.1'
    //Spring Dependencies
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.kafka:spring-kafka:2.2.8.RELEASE'
    //protobuf
    implementation 'com.google.protobuf:protobuf-java-util:3.7.1'
    implementation 'com.google.protobuf:protobuf-java:3.7.1'
    //lombok
    compileOnly 'org.projectlombok:lombok:1.18.6'
    annotationProcessor 'org.projectlombok:lombok:1.18.6'

    //postges
    implementation 'org.postgresql:postgresql:42.2.8'


    // Use JUnit test framework
    // Use JUnit test framework
    testImplementation 'org.apache.kafka:kafka_2.12:2.2.1'
    testImplementation 'org.apache.kafka:kafka_2.12:2.2.1:test'
    testImplementation 'org.apache.kafka:kafka-streams-test-utils:2.2.1'
    testImplementation('org.springframework.kafka:spring-kafka-test:2.2.8.RELEASE'){ 
        exclude group: 'org.apache.kafka', module: 'kafka_2.11'
    }
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'junit:junit:4.12'
    testRuntimeClasspath 'com.h2database:h2'


    implementation 'org.mock-server:mockserver-netty:3.10.8'
    implementation 'org.mock-server:mockserver-client-java:3.10.8'

}

application.yml 具有:

spring:
  datasource:
    initialization-mode: never
    hikari:
      connectionTimeout: ${POSTGRES_CONNECTION_TIMEOUT}
      maximumPoolSize: ${POSTGRES_POOL_SIZE}
    platform: postgres
    url: ${POSTGRES_URL}
    username: ${POSTGRES_USER}
    password: ${POSTGRES_USER_PASSWORD}
  jpa:
    hibernate:
      ddl-auto: none
  kafka:
    application-id: notification-recipient-persistent-stream
    bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS}
    client-id: ${spring.kafka.application-id}
    group-id: ${spring.kafka.client-id}-group
    streams:
      auto-startup: true
      properties:
        max:
          task:
            idle:
              ms: 7200000
        receive:
          buffer:
            bytes: 16777216

关于我在做什么错的任何想法吗?

0 个答案:

没有答案