@GetMapping和@RequestMapping(method = RequestMethod.GET)注释之间的区别 [英] Difference between the annotations @GetMapping and @RequestMapping(method = RequestMethod.GET)
问题描述
@GetMapping
和 @RequestMapping(method = RequestMethod.GET)
之间有什么区别?
我在一些Spring Reactive示例中看到,使用
@GetMapping
而不是 @RequestMapping
What's the difference between @GetMapping
and @RequestMapping(method = RequestMethod.GET)
?
I've seen in some Spring Reactive examples, that
@GetMapping
was used instead of @RequestMapping
推荐答案
@GetMapping
是一个组合注释,充当的快捷方式@RequestMapping(方法= RequestMethod.GET)
。
@GetMapping
is a composed annotation that acts as a shortcut for @RequestMapping(method = RequestMethod.GET)
.
@GetMapping
是较新的注释。
它支持消费
@GetMapping
is the newer annotaion.
It supports consumes
消费选项是:
消费=文/普通
消耗= {text / plain,application / *}
有关详细信息,请参阅:
GetMapping Annotation
For Further details see: GetMapping Annotation
或读取:
请求映射变体
RequestMapping也支持消费
这篇关于@GetMapping和@RequestMapping(method = RequestMethod.GET)注释之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!