基于上一篇《Springboot 整合 Mybatis 的完整 Web 案例》,这边我们着重在 控制层 讲讲。讲讲如何在 Springboot 实现 Restful 服务,基于 HTTP / JSON 传输。
运行环境:JDK 7 或 8、Maven 3.0+
技术栈:SpringBoot 1.5+、SpringBoot Mybatis Starter 1.2+ 、MyBatis 3.4+
前言
spring-boot-starter-web
在 Spring Boot 快速入门中,只要在 pom.xml 加入了 spring-boot-starter-web 依赖,即可快速开发 web 应用。可见,Spring Boot 极大地简化了 Spring 应用从搭建到开发的过程,做到了「开箱即用」的方式。Spring Boot 已经提供很多「开箱即用」的依赖,如上面开发 web 应用使用的 spring-boot-starter-web ,都是以 spring-boot-starter-xx 进行命名的。