Springboot second use: Integrate MyBatis (XML) and add Pagehelper plugins

Source: Internet
Author: User

Integration MyBatis is based on the previous project, the previous project specific integration please refer to springboot use one.

I. Integrated MyBatis

Integration of the MyBatis can be downloaded from the MyBatis official website MyBatis website Integrated Project Mybatis-spring-boot-start. Interested in the principle can be studied 21, here only the steps are described.

Introduce dependencies:

<dependency><groupId>org.mybatis.spring.boot</groupId><artifactId> Mybatis-spring-boot-starter</artifactid><version>1.1.1</version></dependency>
<dependency><groupId>ognl</groupId><artifactId>ognl</artifactId><version> 3.1.2</version><scope>test</scope><exclusions><exclusion><groupid> Javassist</groupid><artifactid>javassist</artifactid></exclusion></exclusions> </dependency><dependency><groupid>org.javassist</groupid><artifactid>javassist </artifactId><version>3.20.0-GA</version><scope>test</scope></dependency>

Add the MyBatis related configuration in the Application.properties file:

Mybatis.mapperlocations=sample/mybatis/mapper/*.xmlmybatis.configlocation=classpath:mybatis-config.xml
Logging.level.sample.mybatis.mapper=trace

The mapper related *.xml and mybatis-config.xml are then placed in the corresponding position.

Note: Mybatis-config.xml configuration path is specified, you must add classpath prefix, otherwise you may not find a file error, especially when specifying the project name.

Springboot use: Consolidate MyBatis (XML) and add Pagehelper plugins

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.