您当前的位置: 首页 >  mybatis

暂无认证

  • 0浏览

    0关注

    92582博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Spring Boot项目升级:Mybatis升级碰到的问题对应

发布时间:2020-09-05 07:38:48 ,浏览量:0

这篇文章记录一下Spring Boot从1.5.22升级至2.3.3后,升级Mybatis所碰到的问题。

目录
  • 版本说明
  • 问题现象
  • 修改参考
  • 修改方式
版本说明
  • Spring Boot版本:2.3.3

  • Mybatis升级前

org.mybatis.spring.bootmybatis-spring-boot-starter1.3.5
  • Mybatis升级后
org.mybatis.spring.bootmybatis-spring-boot-starter2.1.3
问题现象
[main] ERROR org.springframework.boot.web.embedded.tomcat.TomcatStarter - Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'SSOFilterConfig': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SSOFilter': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SSOService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoSupport': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionTemplate' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionTemplate' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'createSqlSessionFactoryBean' defined in class path resource [AAAA.class]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'URL [jar:file:/Users/liumiao/Desktop/BBB.jar!/BOOT-INF/lib/cd-2.1.7.jar!/CCC.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'URL [jar:file:/Users/liumiao/Desktop/BBB.jar!/BOOT-INF/lib/DDD.jar!/CCC.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Ambiguous collection type for property 'children'. You must specify 'javaType' or 'resultMap'.
...
org.apache.ibatis.builder.BuilderException: Ambiguous collection type for property 'children'. You must specify 'javaType' or 'resultMap'
...
WARN  org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
...

修改示例

修改参考

参考了如下Mybatis官方内容,所提示的方法中没有解决本文的问题,但是给出了提示。

  • https://github.com/mybatis/mybatis-3/issues/364
修改方式

最终使用如下方式修改解决了升级时在运行阶段碰到的问题。

  • 修改前

		
  • 修改后

	
关注
打赏
1653961664
查看更多评论
立即登录/注册

微信扫码登录

0.8684s