优化、精简代码。使用 @GetMapping、@PostMapping 替换 @RequestMapping

This commit is contained in:
kl
2022-07-25 17:26:02 +08:00
committed by kl
parent 6efe15788c
commit b099d52520
7 changed files with 86 additions and 80 deletions

View File

@@ -1,8 +1,7 @@
package cn.keking.web.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.GetMapping;
/**
* 页面跳转
@@ -12,12 +11,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class IndexController {
@RequestMapping(value = "/index", method = RequestMethod.GET)
@GetMapping( "/index")
public String go2Index(){
return "index";
}
@RequestMapping(value = "/", method = RequestMethod.GET)
@GetMapping( "/")
public String root() {
return "redirect:/index";
}