GetMapping与PostMapping区别

ComponentScan

SpringBoot会自动扫描启动类所在包及以下的bean,如果在启动类上添加@ComponentScan注解,将不会自动扫描,而是通过指定进行包的扫描。

GetMapping与PostMapping区别

(1)@GetMapping是@RequestMapping(method = RequestMethod.GET)缩写的组合注解,用于将 HTTP 的get 请求映射到特定处理程序的方法注解。

(2)@PostMapping是@RequestMapping(method = RequestMethod.POST)缩写的组合注解,用于将 HTTP 的post 请求映射到特定处理程序的方法注解。

源码:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_42875600/article/details/129773511