1、
@SpringBootApplication
    @SpringBootConfiguration
        @Configuration #3.X引入的标签,用来代替XML的Bean
    @EnableAutoConfiguration #自动加载jar配置
    @ComponentScan #代替 <context:component-scan> 扫描

2、
@RestController
    @Controller 处理分发的请求
    @ResponseBody 将数据封装成对象,返回给前端
在springboot中@RestController 其实就是对@Controller @ResponseBody 组合在一起进行为封装,不用像springmvc一样单独每个去配置,简化了代码。

3、
@RequestMapping #处理请求地址映射,可以用在类上,也可以用在方法上,但用在类上时只能做为父路径,需要和方法配合使用
@GetMapping #是@RequestMapping(method = RequestMethod.GET)封装的一种写法,简化了代码,且只能用在方法上
@PostMapping #是@RequestMapping(method = RequestMethod.POST)封装的一种写法,简化了代码,且只能用在方法上

4、
@Value #用于获取配置信息 写法“ @Value("${msg.error}") ”

5、@ControllerAdvice 全局异常处理

 

更多推荐

springboot 常用核心注解说明