@RestController 可以代替@Controller使用,使用了@RestController的控制器默认所有请求方法都用了@ResponseBody注解。

 

@GetMapping("oneName") 与@RequestMapping(value = "oneName", method = RequestMethod.GET)等价。

 

@PostMapping、@PutMapping等,同理。

 

为了使代码简洁一点,以后优先使用@RestController和@GetMapping。

 

相关文章:

  • 2021-11-05
  • 2021-10-13
  • 2021-05-25
  • 2021-09-22
  • 2022-12-23
  • 2021-06-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
  • 2022-01-24
  • 2021-08-25
  • 2022-12-23
  • 2021-08-04
相关资源
相似解决方案