1. If the MyBatis XML file is placed under the Java folder (idea does not compile the XML file for the SRC Java directory), you need to include the following code in the Pom.xml:
<build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </ resource> </resources> </build>
2.mybatis configuration file do not appear classpath
3.spring integration with MyBatis key configurations
<!--spring and MyBatis integration to achieve a mapping between XML and Mapper-<bean id="sqlsessionfactory" class="Org.mybatis.spring.SqlSessionFactoryBean"> <property name="DataSource" ref="DataSource"/> <!--automatically scan mapping.xml files--<property name="mapperlocations"Value="Classpath:mybatis/xml/*.xml"/> <!--<property name="configlocation"Value="Classpath:mybatis/mybatis-config.xml"/>--> </bean> <!--Spring Auto-Scan mapper interface, production agent, inject spring-to-<beanclass="Org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="Basepackage"Value="Com.ytud.dao.mapper"/> <property name="Sqlsessionfactorybeanname"Value="sqlsessionfactory"/> </bean>
IDEA Integrated spring+spring mvc+mybatis problem