controller的使用
@Controller 处理http请求 //需要配合thymeleaf使用,就是在pom.xml中加入thymeleaf的依赖,然后在resource目录下建立templates文件夹,下面建立index.html页面,输入内容,用于调用。
@RestController Spring4之后新加的注解,原来返回json需要@ResponseBody配合@Controller
@RequestMapping 配置url映射 例:@RequestMapping(value = {"/hello", "/hi"} , method = RequestMathod.Get)

@PathVariable 获取url中的数据

@RequestParam 获取请求参数的值


@GetMapping 组合注解

浙公网安备 33010602011771号