安装全新的 MyBatis-Plus 3.0 版本基于 JDK8,提供了 lambda 形式的调用,所以安装集成 MP3.0 要求如下:
Release
Spring BootMaven:
[AppleScript] 纯文本查看 复制代码
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.0.7.1</version>
</dependency>
Gradle:
[AppleScript] 纯文本查看 复制代码
compile group: 'com.baomidou', name: 'mybatis-plus-boot-starter', version: '3.0.7.1'
Spring MVCMaven:
[AppleScript] 纯文本查看 复制代码
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>3.0.7.1</version>
</dependency>
Gradle:
[AppleScript] 纯文本查看 复制代码
compile group: 'com.baomidou', name: 'mybatis-plus', version: '3.0.7.1'
[AppleScript] 纯文本查看 复制代码
WARNING
引入 MyBatis-Plus 之后请不要再次引入 MyBatis 以及 MyBatis-Spring,以避免因版本差异导致的问题。
Snapshot快照 SNAPSHOT 版本需要添加仓库,且版本号为快照版本。
Maven:
Gradle:
[AppleScript] 纯文本查看 复制代码
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
配置MyBatis-Plus 的配置异常的简单,我们仅需要一些简单的配置即可使用 MyBatis-Plus 的强大功能!
Spring Boot 工程:
[AppleScript] 纯文本查看 复制代码
@SpringBootApplication
@MapperScan("com.baomidou.mybatisplus.samples.quickstart.mapper")
public class Application {
public static void main(String[] args) {
SpringApplication.run(QuickStartApplication.class, args);
}
}