Spring整合mybatis遇到的问题

Spring整合Mybatis遇到的错误

1、

Error creating bean with name 'datasource' defined in class path resource [application.xml]: 
Initialization of bean failed; nested exception is org.springframework.beans.
ConversionNotSupportedException:
 Failed to convert property value of type 'java.lang.String' to required type 'java.sql.Driver' for property 'driver'; 
nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'java.sql.Driver' for property 'driver': 
no matching editors or conversion strategy found

问题决绝办法:

在这里插入图片描述

在使用DruidDatasource时候 使用了driver 属性,而这个属性需要的是一个Dirver驱动,而我的却是一个String类型

所以只需要把 driver改为driverClassName就运行成功啦

在这里插入图片描述

2、

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'sqlSessionFactroy' defined in class path resource [application.xml]: 
Error setting property values; 
nested exception is org.springframework.beans.PropertyBatchUpdateException; 
nested PropertyAccessExceptions (1) are:PropertyAccessException 1: org.springframework.beans.MethodInvocationException:
 Property 'dataSource' threw exception; 
nested exception is java.lang.NoClassDefFoundError: 
org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy

这个错误是真的离谱 忘记导jdbc的包了 哈哈哈蠢死我

        <!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>5.3.2</version>
        </dependency>

导入之后就可以运行啦 !

3、

java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed

这个是网上大佬提出来的

需要在url后面添加一个allowPublicKeyRetrieval=true

4、(还有问题是真的服了)

java.sql.SQLException: Access denied for user 'Administrator'@'localhost' (using password: YES)

修改一下Username的这个属性的名字就好了

在这里插入图片描述

具体的原因请参考

https://blog.csdn.net/qq_40147863/article/details/86498386

终于跑起来啦!不容易啊

在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

秃头路上的小强

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值