前言
这一章主要是列举一下SpringBoot中常用到的注解。
注解
// SpringBoot 核心注解,它是复合注解,里面包括下面三个注解,分别为注解类,扫描包加载Spring Bean,自动配置。
@SpringBootApplication
@EnableAutoConfiguration,@ComponentScan,@SpringBootConfiguration
// 集成mybatis后,指定接口地址,不用每一个接口上都使用@mapper注解
@MapperScan
// 将类纳入Spring容器管理(分层思想)
@Controller
@Service
@Repository
@Component
// 等同于@Controller+@ResponseBody 该类下每一个方法都会返回json字符串
@RestController
// 等同于@RequestMapping+method=get
// 一般还是就使用get/post
@GetMapping
@PostMapping
@DeleteMapping
@PutMapping
// Resultfull架构风格
@PathVariable
优秀相关文章
https://www.cnblogs.com/nihaorz/p/10528121.html
结束语
其实学习一门技术最好的方式就是看官方文档SpringBoot官网,全而详细,本章只是列举了一些比较常用的,为的就是加强记忆,本文也会根据自己的工作随时更新。