springboot的注解

1@RestController和@RestMapping是springMVC的注解,不是springboot的注解

2@RestController=@Controller+@ResponseBody  ,ResponseBody是返回json类型的数据

3@SpringBootApplication=@Configuration+@EnableAutoConfiguration+@ComponentScan

4@GetMapping=@RequestMapping(Method=RequestMethod.GET)

5@PostMapping=@RequestMapping(Method=RequestMethod.POST)

6@PutMapping=@RequestMapping(Method=RequestMethod.PUT)

7@DelsteMapping=@RequestMapping(Method=RequestMethod.DELETE)

8jackson的处理和关闭

指定字段不返回:@JsonIgore

指定日期样式 @JsonFormat(pattern="yyyy-MM-dd hh:mm:ss",locale="zh",timezone="GMT+8")

空字段不返回 @JsonInclude(Include.NON_NULL)

指定别名:@JsonProperty

 

可以通过ctrl+鼠标左键去查看对应的注解是怎么实现的,也可以自定义注解

posted @ 2020-08-12 22:26  我是一只老白兔  阅读(365)  评论(0编辑  收藏  举报