无法将''下的属性绑定到com.zaxxer.hikari.HikariDataSource Spring Boot

问题描述:

当我尝试运行spring boot应用程序时出现以下错误.

I am getting following error when I try to run spring boot application.

Description:

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

    Property: driverclassname
    Value: oracle.jdbc.OracleDriver
    Origin: "driverClassName" from property source "source"
    Reason: Unable to set value for property driver-class-name

Action:

Update your application's configuration

这是相同的问题我有,但我没有使用Maven.

This is same issue I have but i am not using maven.

我正在将spring Boot 2.0.0与以下启动器一起使用.

I am using spring Boot 2.0.0 with following starters.

dependencies {
    compile "org.springframework.boot:spring-boot-starter-web"
    compile "org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.1"
    testCompile "org.springframework.boot:spring-boot-starter-test"
}

这是我的application.properties文件

spring.datasource.url= *****
spring.datasource.username= ******
spring.datasource.password= ******

正如 Stephane Nicoll 所说,你不知道您的类路径上没有驱动程序.您需要在gradle构建中包括jdbc驱动程序,如下所示.但是,您不必坚持我提供的驱动程序版本.

As Stephane Nicoll said, you don't have driver on your classpath. You need to include jdbc driver on your gradle build as below. However, you don't have to stick to driver version that I have included.

dependencies {
    compile "org.springframework.boot:spring-boot-starter-web"
    compile "org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.1"
    testCompile "org.springframework.boot:spring-boot-starter-test"
    runtime('com.oracle:ojdbc7:12.1.0.2.0') 
}