talira

MyBatis-Plus

Enhancement toolkit for MyBatis that cuts boilerplate in Java data access

open sourceApache-2.0free

MyBatis-Plus is a toolkit on top of MyBatis for Java that stays fully compatible with it while adding ready-made CRUD interfaces, a flexible where-condition wrapper with a lambda-style API, primary key generation strategies, automatic pagination, active record support, SQL injection defence and a customisable code generator. Spring Boot starters configure it at startup (separate ones for Spring Boot 2, 3 and 4), and @MybatisPlusTest helps write tests. Install it from Maven Central under com.baomidou.

Problems it solves

  • stop writing the same CRUD mapper XML for every table in a MyBatis project
  • add pagination to MyBatis queries in Spring Boot without hand-written SQL
  • build MyBatis queries in Java with type-safe conditions instead of strings

Features

  • fully compatible with MyBatis
  • ready-made CRUD interfaces
  • where-condition wrapper with a lambda-style API
  • primary key generation strategies
  • automatic pagination
  • active record support
  • SQL injection defence
  • customisable code generator
  • Spring Boot starters for Spring Boot 2, 3 and 4

Alternatives

The same job

These do what MyBatis-Plus does.

  1. PageHelper Pagination plugin for MyBatis that pages any single-table or multi-table query
  2. MyBatis SQL mapper persistence framework for Java
  3. jOOQ Typesafe SQL query builder and code generator for Java

Compare MyBatis-Plus with the top 3