注释@GetMapping和@RequestMapping之间的区别(方法= RequestMethod.GET)


问题内容

@GetMapping和之间有什么区别@RequestMapping(method = RequestMethod.GET)
我在一些Spring Reactive示例中看到了,它 @GetMapping被用来代替@RequestMapping


问题答案:

@GetMapping是组成的注解,充当的快捷方式@RequestMapping(method = RequestMethod.GET)

@GetMapping是较新的注释。支持消费

消耗选项为:

消耗=“文本/纯文本”
消耗= {“文本/纯文本”,“应用程序/ *”}

有关更多详细信息,请参见:
GetMapping注释

或阅读: 请求映射变体

RequestMapping支持也消耗