记一次错误,自己写的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)

 

Error creating bean with name 'tbItemParamExtendMapper' defined in file

Error creating bean with name 'tbItemParamExtendMapper' defined in file

解决办法

mapper.xml文件中

Error creating bean with name 'tbItemParamExtendMapper' defined in file

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

Error creating bean with name 'tbItemParamExtendMapper' defined in file

Error creating bean with name 'tbItemParamExtendMapper' defined in file

问题修改为

ResultType 改为 ResultMap

Error creating bean with name 'tbItemParamExtendMapper' defined in file

问题总结:

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

记以后遇见Bug要沉着冷静

相关文章: