What is MyBatis-CDI?

MyBatis-CDI extension takes care of the lifecycle of MyBatis mappers and SqlSessions. MyBatis components are directly injected into your CDI beans ready to be used, there is no need to create or destroy them. It also provides local and JTA transaction support based on the @Transactional annotation.


Before starting with MyBatis-CDI integration, it is very important that you are familiar with both MyBatis and CDI terminology. This document does not attempt to provide background information or basic setup and configuration tutorials for either MyBatis or CDI.

MyBatis-CDI requires Java EE 6 or higher and any MyBatis version.

Help make this documentation better…

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!


Users can read about MyBatis in following translations:

Do you want to read about MyBatis in your own native language? File an issue providing patches with your mother tongue documentation!