IDEA Integrated spring+spring mvc+mybatis problem

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.