首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未能将“”下的属性绑定到com.zaxxer.hikari.HikariDataSource Spring

问未能将“”下的属性绑定到com.zaxxer.hikari.HikariDataSource Spring
EN

Stack Overflow用户
提问于 2018-05-07 13:51:40
回答 16查看 119.1K关注 0票数 49

当我试图运行spring引导应用程序时,我会得到以下错误。

代码语言:javascript
复制
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

这是我拥有的same issue,但我不使用maven。

我使用的是spring Boot 2.0.0和下面的启动器。

代码语言:javascript
复制
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文件

代码语言:javascript
复制
spring.datasource.url= *****
spring.datasource.username= ******
spring.datasource.password= ******
EN

回答 16

Stack Overflow用户

回答已采纳

发布于 2018-05-08 21:10:58

正如Stephane Nicoll所说,您的类路径上没有司机。您需要在您的gradle构建中包括jdbc驱动程序,如下所示。但是,您不必坚持我已经包含的驱动程序版本。

代码语言:javascript
复制
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') 
}
票数 32
EN

Stack Overflow用户

发布于 2018-11-21 14:29:47

我也有同样的问题(Spring 2)

我修正了增加司机级的问题。

查找application.properties文件。

代码语言:javascript
复制
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

全部密码。

代码语言:javascript
复制
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=upate
spring.datasource.url=jdbc:mysql://localhost:3306/database_name
spring.datasource.username=admin
spring.datasource.password=admin1234
票数 42
EN

Stack Overflow用户

发布于 2019-07-11 08:24:18

当从Spring 2.0.6更新到Spring 2.1.6时,我也犯了同样的错误。

在spring.datasource.driver-class-name=com.mysql.jdbc.Driver中显式设置驱动程序类名application.properties解决了这个问题。

票数 10
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50215936

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档