mybatis-spring-boot-starter

Parent pom providing dependency and plugin management for applications built with Maven

License

License

Categories

Categories

Spring Boot Container Microservices MyBatis Data ORM
GroupId

GroupId

xyz.luomu32
ArtifactId

ArtifactId

mybatis-spring-boot-starter
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

mybatis-spring-boot-starter
Parent pom providing dependency and plugin management for applications built with Maven
Project Organization

Project Organization

Pivotal Software, Inc.
Source Code Management

Source Code Management

https://github.com/luomu32/mybatis-spring-boot-starter

Download mybatis-spring-boot-starter

How to add to project

<!-- https://jarcasting.com/artifacts/xyz.luomu32/mybatis-spring-boot-starter/ -->
<dependency>
    <groupId>xyz.luomu32</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/xyz.luomu32/mybatis-spring-boot-starter/
implementation 'xyz.luomu32:mybatis-spring-boot-starter:1.0.0'
// https://jarcasting.com/artifacts/xyz.luomu32/mybatis-spring-boot-starter/
implementation ("xyz.luomu32:mybatis-spring-boot-starter:1.0.0")
'xyz.luomu32:mybatis-spring-boot-starter:jar:1.0.0'
<dependency org="xyz.luomu32" name="mybatis-spring-boot-starter" rev="1.0.0">
  <artifact name="mybatis-spring-boot-starter" type="jar" />
</dependency>
@Grapes(
@Grab(group='xyz.luomu32', module='mybatis-spring-boot-starter', version='1.0.0')
)
libraryDependencies += "xyz.luomu32" % "mybatis-spring-boot-starter" % "1.0.0"
[xyz.luomu32/mybatis-spring-boot-starter "1.0.0"]

Dependencies

compile (5)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter jar 1.5.17.RELEASE
org.springframework.boot : spring-boot-configuration-processor Optional jar 1.5.17.RELEASE
org.springframework.boot : spring-boot-autoconfigure-processor Optional jar 1.5.17.RELEASE
org.mybatis : mybatis jar 3.4.6
org.mybatis : mybatis-spring jar 1.3.2

Project Modules

There are no modules declared in this project.

mybatis-spring-boot-starter

Maven Central

How to use it

  1. first add dependency to your project
<dependency>
   <groupId>xyz.luomu32</groupId>
   <artifactId>mybatis-spring-boot-starter</artifactId>
   <version>LATEST</version>
</dependency>
  1. write xml mapper file and add to ‘mapper’ directory under src/main/resources
  2. write java data access class and with @Mapper annotation
  3. 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:

mybatis:
  mapper-locations: classpath:mapper/*.xml

or

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.

mybatis:
  mapper-base-package: com.xxx.xxx.dao

Plugin

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.

Versions

Version
1.0.0