三月 25, 2021 11:22:40 下午 org.springframework.context.support.AbstractApplicationContext refresh
警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [D:\WebSutdy\Spring\target\classes\com\tty\mapper\TeacherInt.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘file [D:\WebSutdy\Spring\target\classes\com\tty\mapper\TeacherInt.xml]’. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.tty.mapper.TeacherInt.teacher
发现错误
检查Bean标签id为SqlSessionFactroy配置
查看mybatis-cofig.xml文件
得出结论:
解决办法
将mybatis-confi和spring容器绑定共同绑定的的mapper
文件,取消一方绑定共同的mapper文件既可