配置文件错了,有谁帮我看一下吗。我找不到。
D:\Environment\Java\jdk1.8.0_202\bin\java.exe -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:\development tool\Idea\IntelliJ IDEA 2021.2.2\lib\idea_rt.jar=56407:D:\development tool\Idea\IntelliJ IDEA 2021.2.2\bin" -Dfile.encoding=UTF-8 -classpath "D:\development tool\Idea\IntelliJ IDEA 2021.2.2\lib\idea_rt.jar;D:\development tool\Idea\IntelliJ IDEA 2021.2.2\plugins\junit\lib\junit5-rt.jar;D:\development tool\Idea\IntelliJ IDEA 2021.2.2\plugins\junit\lib\junit-rt.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\charsets.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\deploy.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\ext\access-bridge-64.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\ext\cldrdata.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\ext\dnsns.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\ext\jaccess.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\ext\jfxrt.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\ext\localedata.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\ext\nashorn.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\ext\sunec.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\ext\sunjce_provider.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\ext\sunmscapi.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\ext\sunpkcs11.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\ext\zipfs.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\javaws.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\jce.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\jfr.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\jfxswt.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\jsse.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\management-agent.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\plugin.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\resources.jar;D:\Environment\Java\jdk1.8.0_202\jre\lib\rt.jar;E:\MyProword\IDEA\ssm-crud\target\classes;D:\Environment\apache-maven-3.8.3\maven-repo\org\mybatis\generator\mybatis-generator-core\1.3.7\mybatis-generator-core-1.3.7.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\springframework\spring-webmvc\5.3.20\spring-webmvc-5.3.20.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\springframework\spring-aop\5.3.20\spring-aop-5.3.20.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\springframework\spring-beans\5.3.20\spring-beans-5.3.20.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\springframework\spring-context\5.3.20\spring-context-5.3.20.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\springframework\spring-core\5.3.20\spring-core-5.3.20.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\springframework\spring-jcl\5.3.20\spring-jcl-5.3.20.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\springframework\spring-expression\5.3.20\spring-expression-5.3.20.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\springframework\spring-web\5.3.20\spring-web-5.3.20.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\springframework\spring-jdbc\5.3.20\spring-jdbc-5.3.20.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\springframework\spring-tx\5.3.20\spring-tx-5.3.20.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\springframework\spring-aspects\5.3.20\spring-aspects-5.3.20.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\aspectj\aspectjweaver\1.9.7\aspectjweaver-1.9.7.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\mybatis\mybatis\3.5.9\mybatis-3.5.9.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\mybatis\mybatis-spring\2.0.6\mybatis-spring-2.0.6.jar;D:\Environment\apache-maven-3.8.3\maven-repo\c3p0\c3p0\0.9.1.2\c3p0-0.9.1.2.jar;D:\Environment\apache-maven-3.8.3\maven-repo\mysql\mysql-connector-java\8.0.28\mysql-connector-java-8.0.28.jar;D:\Environment\apache-maven-3.8.3\maven-repo\com\google\protobuf\protobuf-java\3.11.4\protobuf-java-3.11.4.jar;D:\Environment\apache-maven-3.8.3\maven-repo\jstl\jstl\1.2\jstl-1.2.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\springframework\spring-test\5.3.20\spring-test-5.3.20.jar;D:\Environment\apache-maven-3.8.3\maven-repo\javax\servlet\javax.servlet-api\4.0.1\javax.servlet-api-4.0.1.jar;D:\Environment\apache-maven-3.8.3\maven-repo\junit\junit\4.13.1\junit-4.13.1.jar;D:\Environment\apache-maven-3.8.3\maven-repo\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 com.liiulizheng.crud.test.MapperTest,testCRUD
七月 08, 2022 12:25:41 上午 org.springframework.test.context.support.AbstractTestContextBootstrapper getDefaultTestExecutionListenerClassNames
信息: Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.event.ApplicationEventsTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
七月 08, 2022 12:25:41 上午 org.springframework.test.context.support.AbstractTestContextBootstrapper getTestExecutionListeners
信息: Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@2038ae61, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@3c0f93f1, org.springframework.test.context.event.ApplicationEventsTestExecutionListener@31dc339b, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@544fe44c, org.springframework.test.context.support.DirtiesContextTestExecutionListener@31610302, org.springframework.test.context.transaction.TransactionalTestExecutionListener@71318ec4, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@21213b92, org.springframework.test.context.event.EventPublishingTestExecutionListener@a67c67e]
七月 08, 2022 12:25:42 上午 com.mchange.v2.log.MLog <clinit>
信息: MLog clients using java 1.4+ standard logging.
七月 08, 2022 12:25:42 上午 com.mchange.v2.c3p0.C3P0Registry banner
信息: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
七月 08, 2022 12:25:43 上午 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 file [E:\MyProword\IDEA\ssm-crud\target\classes\applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\MyProword\IDEA\ssm-crud\target\classes\mapper\DepartmentMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\MyProword\IDEA\ssm-crud\target\classes\mapper\DepartmentMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.liiulizheng.crud.dao.DepartmentMapper.BaseResultMap
七月 08, 2022 12:25:43 上午 org.springframework.test.context.TestContextManager prepareTestInstance
严重: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@544fe44c] to prepare test instance [com.liiulizheng.crud.test.MapperTest@463fd068]
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:248)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in file [E:\MyProword\IDEA\ssm-crud\target\classes\applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\MyProword\IDEA\ssm-crud\target\classes\mapper\DepartmentMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\MyProword\IDEA\ssm-crud\target\classes\mapper\DepartmentMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.liiulizheng.crud.dao.DepartmentMapper.BaseResultMap
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:248)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in file [E:\MyProword\IDEA\ssm-crud\target\classes\applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\MyProword\IDEA\ssm-crud\target\classes\mapper\DepartmentMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\MyProword\IDEA\ssm-crud\target\classes\mapper\DepartmentMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.liiulizheng.crud.dao.DepartmentMapper.BaseResultMap
Caused by: org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\MyProword\IDEA\ssm-crud\target\classes\mapper\DepartmentMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\MyProword\IDEA\ssm-crud\target\classes\mapper\DepartmentMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.liiulizheng.crud.dao.DepartmentMapper.BaseResultMap
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\MyProword\IDEA\ssm-crud\target\classes\mapper\DepartmentMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.liiulizheng.crud.dao.DepartmentMapper.BaseResultMap
Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.liiulizheng.crud.dao.DepartmentMapper.BaseResultMap
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:contxst="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
https://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
https://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<contxst:component-scan base-package="com.liiulizheng">
<contxst:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</contxst:component-scan>
<!-- Spring的配置文件,这里主要配置和业务逻辑有关的 -->
<!-- ====================数据源,事务控住,Xxx====================-->
<contxst:property-placeholder location="classpath:dbconfig.properties"/>
<bean id="pooledDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>
<property name="driverClass" value="${jdbc.driverClass}"></property>
<property name="user" value="${jdbc.user}"></property>
<property name="password" value="${jdbc.password}"></property>
</bean>
<!-- ====================配置MyBatis的整合====================-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 指定mybatis配置文件位置-->
<property name="configLocation" value="classpath:mybatis-config.xml"></property>
<property name="dataSource" ref="pooledDataSource"></property>
<!-- 指定mybatis,mapper文件的位置-->
<property name="mapperLocations" value="classpath:mapper/*.xml"></property>
</bean>
<!-- 配置扫描器,将mybatis接口的实现加入到ioc容器中-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 扫描所以到接口的实现,加入到IOC容器中-->
<property name="basePackage" value="com.liiulizheng.crud.dao"></property>
</bean>
<!-- ====================事务控住的配置====================-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<!-- 控制数据源-->
<property name="dataSource" ref="pooledDataSource"></property>
</bean>
<!-- 开启基于注解的事务,使用xml配置形式的事务(必须主要的都是使用配置式)-->
<aop:config>
<!-- 切入点表达式-->
<aop:pointcut id="txPoint" expression="execution(* com.liiulizheng.crud.service..*(..))"/>
<!-- 配置事务增强-->
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPoint"/>
</aop:config>
<!-- 配置事务增强,事务如何切入-->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<!-- 所以方法都是事务方法-->
<tx:method name="*"/>
<!-- 以get开始的所有方法-->
<tx:method name="get*" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- Spring配置文件的核心点(数据源、与mybatis的整合、事务控制)-->
</beans>