【SpringBoot】 Error creating bean with name ‘jdbcConverter‘ defined in class

Error creating bean with name ‘jdbcConverter’ defined in class

一、问题描述

一个springboot项目,使用 jdbc 方式连接 MySQL 数据库,已配置数据源参数的情况下,仍然报以上错误
在这里插入图片描述

二、问题原因

查看最后报错的原因如下 :The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone.数据库的时区和系统的时区不一致导致的

三、问题解决

1. 解决方式一

参考第四节中的3所描述方式进行解决:

# 修改前
spring.datasource.url=jdbc:mysql://localhost:3306/test

# 修改后
spring.datasource.url=jdbc:mysql://localhost:3306/test?serverTimezone=GMT

2. 解决方式2

在 pom.xml 文件中,将 spring-boot-starter-data-jdbc 注释掉,并使用 spring-boot-starter-jdbc 进行替代,该种方式仅仅支持 jdbcTemplate 访问数据库


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>

<!--        <dependency>-->
<!--            <groupId>org.springframework.boot</groupId>-->
<!--            <artifactId>spring-boot-starter-data-jdbc</artifactId>-->
<!--        </dependency>-->

四、参考资料

  1. spring-boot-starter-jdbc 和 spring-boot-starter-data-jdbc 的区别
  2. Error creating bean with name ‘jdbcConverter‘ defined in class path resource
    没有配置数据源时可使用该种解决方式
  3. 解决:The server time zone value ‘�й���׼ʱ��’ is unrecognized or represents more than one time zone.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
【资源说明】 1、基于springboot+mybatis实现的外卖订餐系统源码+项目说明(毕设).zip 2、该资源包括项目的全部源码,下载可以直接使用! 3、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目,作为参考资料学习借鉴。 4、本资源作为“参考资料”如果需要实现其他功能,需要能看懂代码,并且热爱钻研,自行调试。 ### 项目概述 首先来了解项目需求。 项目分为客户端和后台管理系统两个界面,客户端针对普通用户,功能包括用户登陆、用户退出、菜品订购、我的订单。 后台管理系统针对管理员,功能包括管理员登陆、管理员退出、添加菜品、查询菜品、修改菜品、删除菜品、订单处理、添加用户、查询用户、删除用户。 需求了解完之后,接下来设计系统,首先分配出4个服务提供者,account、menu、order、user。 - account - 提供账户服务:用户和管理员登陆。 - menu - 提供菜品服务:添加菜品、查询菜品、修改菜品、删除菜品。 - order - 提供订单服务:添加订单、查询订单、删除订单、处理订单。 - user - 提供用户服务:添加用户、查询用户、删除用户、用户修改。 ## 异常 - org.springframework.beans.factory.UnsatisfiedDependencyException 不满足依赖异常 - org.springframework.beans.factory.BeanCreationException - org.springframework.beans.BeanInstantiationException - org.springframework.core.NestedIOException - org.apache.ibatis.builder.BuilderException - java.lang.IllegalArgumentException ``` Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [C:\Users\GUSHI\IdeaProjects\springboot2\target\classes\mapping\UserRepository.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for com.m.dao.AdminDao.login at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType (AbstractAutowireCapableBeanFactory.java:1431)

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值