Failed to bind properties under 'spring.datasource.type' to java.lang.Class

本文介绍SpringBoot2.0中数据源配置的变化,解释为何无法直接设置spring.datasource.type属性,并提供正确的配置方法。

刚创建的 Spring Boot 2.0 项目,启动后输出:

Failed to bind properties under 'spring.datasource.type' to java.lang.Class<javax.sql.DataSource>:

    Property: spring.datasource.type
    Value: org.apache.tomcat.jdbc.pool.DataSource
    Origin: class path resource [application.properties]:5:24
    Reason: No converter found capable of converting from type [java.lang.String] to type [java.lang.Class<javax.sql.DataSource>]

Action:

Update your application's configuration

1.5 的项目可以使用

spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource

但2.0 却不行,那就把它删除,默认配置为:

tomcat-jdbc


评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值