• 主页
  • Java SE
  • J2ME
  • Web开发
  • Java EE
  • Eclipse
LiZhuzhuGo 05月03日
关于mybatis的mapper.xml问题,求大神解答
今天我用springboot和mybatis做了一个小项目,用逆向工程生成了实体类,mapper,和mapper.xml。我用注解写的普通查询都正常使用,当我用到mapper里面自动生成的mapper的增删改查的方法的时候就会报找不到xml的错误,于是我在yml文件中配置了 mapper-locations: classpath:mybatis/mapper/*.xml这个路劲,结果出现了新的错误,求大神解答啊
第一行完整报错是这样的:org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminController': Unsatisfied dependency expressed through field 'iCarDetail'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'carDetailImpl': Unsatisfied dependency expressed through field 'carDetailMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'carDetailMapper' defined in file [C:\Users\留不住的年华\Desktop\dragon-f\target\classes\teach\aistar\mapper\CarDetailMapper.class]: 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\留不住的年华\Desktop\dragon-f\target\classes\mybatis\mapper\CarBrandsMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [C:\Users\留不住的年华\Desktop\dragon-f\target\classes\mybatis\mapper\CarBrandsMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for teach.aistar.mapper.CarBrandsMapper.BaseResultMap

...全文
205 点赞 收藏 5
写回复
5 条回复

还没有回复,快来抢沙发~

发动态
发帖子
Java
创建于2007-09-28

1.7w+

社区成员

8.1w+

社区内容

Java相关技术讨论
社区公告
暂无公告