单元测试代码如下:
运行后控制台报错
Caused by: 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:\eclipse2019_jdk\2019xiangmu\television\target\classes\mapper\AdminMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘file [D:\eclipse2019_jdk\2019xiangmu\television\target\classes\mapper\AdminMapper.xml]’. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.syn.television.dao.AdminMapper.BaseResultMap |
---|
而我的spring配置文件是
经过在网上搜索,并借鉴了https://www.cnblogs.com/hfx123/p/9685721.html
将注释掉,就运行成功了(具体原因我现在也不是太明白)
也希望路过的大神,给出你们的理解。