Error creating bean with name 'tbItemParamExtendMapper' defined in file

记一次错误,自己写的mapper接口和mapper.xml,结果将类型写错了,报下面的错误

Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemParamServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.e3mall.param.mapper.TbItemParamExtendMapper cn.e3mall.service.impl.ItemParamServiceImpl.itemParamExtendMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.e3mall.param.mapper.TbItemParamExtendMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tbItemParamExtendMapper' defined in file [E:\project\workspace\JavaEE32\e3-manager\e3-manager-service\target\classes\cn\e3mall\param\mapper\TbItemParamExtendMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'LONGVACHAR'.  Cause: java.lang.ClassNotFoundException: Cannot find class: LONGVACHAR
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tbItemParamExtendMapper' defined in file [E:\project\workspace\JavaEE32\e3-manager\e3-manager-service\target\classes\cn\e3mall\param\mapper\TbItemParamExtendMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'LONGVACHAR'.  Cause: java.lang.ClassNotFoundException: Cannot find class: LONGVACHAR
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)

 

解决办法

mapper.xml文件中

将红框内容改为jdbcType="LONGVARCHAR"

问题修改为

ResultType 改为 ResultMap

问题总结:

     遇见Bug一定要耐心,细心,只有去耐心的去看报错信息,才能更快的解决问题。心烦意躁,急迫的想解决问题,反而问题不容易解决。这次错误花费了我一晚上,心烦意燥的代价,发现每次Bug修改都花费较多时间,每次都是自己不细心,没有仔细看报错信息,导致花费较多时间,

记以后遇见Bug要沉着冷静

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值