Exception encountered during context initialization - cancelling refresh attempt: 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 [D:\workspace\Yinglibao\work\micr-dataservice\target\classes\mappers\BidInfoMapper.xml]';
nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [D:\workspace\Yinglibao\work\micr-dataservice\target\classes\mappers\BidInfoMapper.xml]'.
Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.bjpowernode.dataservice.mapper.BidInfoMapper.BaseResultMap
关键在于
Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.bjpowernode.dataservice.mapper.BidInfoMapper.BaseResultMap
原因:
是BaseResultMap出了问题,原因是 BaseResultMap这个结果出现了多次。
解决:
在相应文件中删除重复出现的BaseResultMap代码。
在初始化SpringBoot应用时遇到BeanCreationException,具体原因是尝试创建SqlSessionFactory时失败,进一步追踪发现是由于在BidInfoMapper.xml文件中的BaseResultMap定义重复导致的。解决方案是检查并删除XML文件中多余的BaseResultMap代码。
4766

被折叠的 条评论
为什么被折叠?



