Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luomu32/mybatis-spring-boot-starter
a simple spring boot starter for mybatis
https://github.com/luomu32/mybatis-spring-boot-starter
mybatis spring-boot-starter
Last synced: 22 days ago
JSON representation
a simple spring boot starter for mybatis
- Host: GitHub
- URL: https://github.com/luomu32/mybatis-spring-boot-starter
- Owner: luomu32
- License: mit
- Created: 2018-10-18T05:04:39.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-22T18:34:32.000Z (over 3 years ago)
- Last Synced: 2023-07-07T15:38:53.966Z (over 1 year ago)
- Topics: mybatis, spring-boot-starter
- Language: Java
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mybatis-spring-boot-starter
![Maven Central](https://img.shields.io/maven-central/v/xyz.luomu32/mybatis-spring-boot-starter.svg)
## How to use it1. first add dependency to your project
```xml
xyz.luomu32
mybatis-spring-boot-starter
LATEST```
2. write xml mapper file and add to ‘mapper’ directory under `src/main/resources`
3. write java data access class and with @Mapper annotation
4. enjoy it## Configuration
### XML mapper file
by the default,the starter will try to load xml file at 'mapper' directory under `src/main/resource`.you can also change it with application.properties or application.yml.like this:
```yaml
mybatis:
mapper-locations: classpath:mapper/*.xml
```or
```yaml
mybatis:
mapper-locations:
- classpath:mapper/*.xml
- classpath:User.xml
```### Java Mapper
by the default,the starter will try to scan Java Mapper with @Mapper annotation under your base project package.you can also dem the package,and the @Mapper annotation will not necessary.
```yaml
mybatis:
mapper-base-package: com.xxx.xxx.dao
```### Plugin
```yaml
mybatis:
interceptors: xyz.luomu32.mybatis.plugin.OptimisticLockInterceptor
```or just add to Spring container with @Compent or @Bean.the starter will get bean which implement `org.apache.ibatis.plugin.Interceptor` from Spring container,and register it to Mybatis.