Installation¶
Requirements¶
- Java 21+ (Spring Boot 3.3 baseline)
- Spring Boot 3.3+
- A JDBC driver (your choice —
mysql-connector-j,postgresql,h2, etc.) mybatis-spring-boot-starter3.x
Adding the dependency¶
What the starter pulls in¶
The starter transitively brings these for you:
spring-boot-starter-aop(the aspect engine)spring-data-commons(justPageable,Page,Sorttypes — not Spring Data JPA)pagehelper-spring-boot-starter(the underlying SQL rewriter)
What you bring yourself¶
These are intentionally not transitive so your project owns the version:
mybatis-spring-boot-starter— wires upDataSource,SqlSessionFactory, and@MapperScan- A JDBC driver for your database
Why aren't these transitive?
Almost every MyBatis project already declares these explicitly with a chosen version. Forcing a version through this starter would cause conflicts. Same reasoning applies to spring-boot-starter-web / webflux — you bring what your app already uses.
Verifying the setup¶
After adding the dependency, the starter auto-registers via Spring Boot's AutoConfiguration mechanism. A minimal proof:
If the starter is loaded, the easy-paging.* keys above will be syntax-highlighted in IntelliJ IDEA (configuration metadata is shipped in the jar) and Spring Boot will accept them at startup.
Continue to the Tutorial for a 5-minute walkthrough of a paginated endpoint.