Skip to main content

dawdler-client-plug-mybatis

Module introduction​

Implements injection of MyBatis Mappers into the service layer on the web side.

1. Add the dependency to the pom​

<groupId>club.dawdler</groupId>
<artifactId>dawdler-client-plug-mybatis</artifactId>

2. MyBatis configuration in web-conf.xml​

web-conf.xml is the core configuration file for the web side. It covers component scanning, data source definition, mapping target packages to data sources, read/write splitting configuration, and health checks.

In this module, the MyBatis-related configuration lives in the values of the mapper child nodes of mybatis, and supports the antPath syntax.

Example:

<mybatis>
<mappers>
<mapper>classpath*:com/anywide/shop/*/mapper/xml/*.xml</mapper>
</mappers>
</mybatis>

3. Inject Mapper​

See Injecting Mapper.