org.springframework.core.convert.ConverterNotFoundException: No converter found capable of convertin

博客内容讲述了在Spring Boot应用启动时遇到`ConverterNotFoundException`的问题,具体表现为无法将`String`类型转换为`java.sql.Driver`。错误源于`application.yml`配置文件中'driver'属性的误配置。解决方案是将配置文件中的'driver'改为'driver-class-name',并清理缓存后再进行编译。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  • ConverterNotFoundExce  ---> 转换器未找到超出

Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.sql.Driver]

        ......
  org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:88)
    at org.springframework.boot.context.properties.bind.Binder.bindProperty(Binder.java:324)
    at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:267)
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:221)
    ... 67 common frames omitted
2022-03-08 08:53:53.253 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter - 

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

Description:

Failed to bind properties under 'spring.datasource.druid.driver' to java.sql.Driver:

    Property: spring.datasource.druid.driver
    Value: com.mysql.cj.jdbc.Driver
    Origin: class path resource [application.yml]:11:15
    Reason: No converter found capable of converting from type [java.lang.String] to type [java.sql.Driver]

Action:

Update your application's configuration

Disconnected from the target VM, address: '127.0.0.1:51259', transport: 'socket'

=================================================================

1.错误的 application.yml 配置

                大部分电脑都不需要这样配置,

                配置中的属性都是颜色都是深色,没有变,是因为  driver: com.mysql.cj.jdbc.Driver

                将 driver 改为 driver-class-name 即可!

2.先clean清除缓存,在compile编译,

 

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值