MyBatis-Spring integrates MyBatis seamlessly with Spring. This library allows MyBatis to participate in Spring transactions, takes care of building MyBatis mappers and SqlSessions and inject them into other beans, translates MyBatis exceptions into Spring DataAccessExceptions, and finally, it lets you build your application code free of dependencies on MyBatis, Spring or MyBatis-Spring.
Spring version 2 only supports iBATIS version 2. An attempt was made to add MyBatis 3 support into Spring 3 (see the Spring Jira issue). Unfortunately, Spring 3 development ended before MyBatis 3 was officially released. Because the Spring team did not want to release with code based on a non-released version of MyBatis, official Spring support would have to wait. Given the interest in Spring support for MyBatis, the MyBatis community decided it was time to reunite the interested contributors and add Spring integration as a community sub-project of MyBatis instead.
Before starting with MyBatis-Spring integration, it is very important that you are familiar with both MyBatis and Spring terminology. This document does not attempt to provide background information or basic setup and configuration tutorials for either MyBatis or Spring.
MyBatis-Spring requires Java 5 or higher and the following MyBatis and Spring versions:
|1.0.0 and 1.0.1||3.0.1 to 3.0.5||3.0.0 or higher|
|1.0.2||3.0.6||3.0.0 or higher|
|1.1.0 or higher||3.1.0 or higher||3.0.0 or higher|
|1.3.0 or higher||3.4.0 or higher||3.0.0 or higher|
A special thanks goes to all the special people who made this project a reality (in alphabetical order): Eduardo Macarron, Hunter Presnall and Putthibong Boonbong for the coding, testing and documentation; Andrius Juozapaitis, Giovanni Cuccu, Mike Lanyon, Raj Nagappan and Tomas Pinos for their contributions; and Simone Tripodi for finding everyone and bringing them all back to the project under MyBatis ;) Without them, this project wouldn't exist.
If you find this documentation lacking in any way, or missing documentation for a feature, then the best thing to do is learn about it and then write the documentation yourself!
Sources of this manual are available in xdoc format at project's Git Fork the repository, update them and send a pull request.
You’re the best author of this documentation, people like you have to read it!