1.团队多人开发,没人设置不同的请求路径,冲突问题如何解决——设置模块名作为请求路径前缀
stuController.java
package com.itheima.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("stu")
public class stuController {
@RequestMapping("/save")
@ResponseBody
public String save(){
System.out.println("stu save ...");
return "";
}
@RequestMapping("/delete")
@ResponseBody
public String delete(){
System.out.println("stu delete...");
return "";
}
}
userController.java
package com.itheima.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/user")
public class UserController {
@RequestMapping("/save")
@ResponseBody
public String save(){
System.out.println("user save....");
return "{sdasd}";
}
@RequestMapping("/delete")
@ResponseBody
public String delete(){
System.out.println("user delete....");
return "";
}
}
利用前缀名来区分访问路径
标签:请求,springframework,响应,org,import,save,public,RequestMapping From: https://www.cnblogs.com/lin513/p/17156618.html