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+鼠标左键去查看对应的注解是怎么实现的,也可以自定义注解

相关文章:

  • 2021-12-31
  • 2021-05-19
  • 2021-12-09
猜你喜欢
  • 2021-07-19
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2021-07-23
  • 2022-01-10
相关资源
相似解决方案