springboot(六):如何优雅的使用mybatis
2017-12-07 09:07
387 查看
mybatis-spring-boot-starter
官方说明:MyBatis Spring-Boot-Starter will help you use MyBatis with Spring Boot
其实就是myBatis看spring boot这么火热也开发出一套解决方案来凑凑热闹,但这一凑确实解决了很多问题,使用起来确实顺畅了许多。mybatis-spring-boot-starter主要有两种解决方案,一种是使用注解解决一切问题,一种是简化后的老传统。
当然任何模式都需要首先引入mybatis-spring-boot-starter的pom文件,现在最新版本是1.1.1(
刚好快到双11了 :))
<dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.1.1</version> </dependency>
好了下来分别介绍两种开发模式
无配置文件注解版
就是一切使用注解搞定。
1 添加相关maven文件
[code]<dependencies><dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.1.1</version> </dependency><dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
相关文章推荐
- springboot(六):如何优雅的使用mybatis
- 【转载】springboot:如何优雅的使用mybatis
- springboot(六):如何优雅的使用mybatis
- MyBatis中如何优雅的使用枚举详解
- springboot(六):如何优雅的使用mybatis
- Spring Boot系列(六):如何优雅的使用mybatis
- springboot(六):如何优雅的使用mybatis
- spring boot(六):如何优雅的使用mybatis
- spring boot(六):如何优雅的使用mybatis
- SpringBoot如何优雅的使用Swagger
- spring boot(六)如何优雅的使用mybatis
- spring boot(六):如何优雅的使用mybatis
- spring boot(六):如何优雅的使用mybatis
- spring boot 集成 mybatis:如何优雅的使用mybatis
- 如何在MyBatis中优雅的使用枚举
- springboot(六):如何优雅的使用mybatis
- spring boot之如何优雅的使用mybatis
- 如何优雅的使用 mybatis
- spring boot(六):如何优雅的使用mybatis
- Spring Boot系列(六):如何优雅的使用mybatis