spring mvc requestmapping 配置多个
参考
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.ResponseBody; import javax.servlet.http.HttpServletRequest; @Controller //@RequestMapping(value = "/test_web/prefix") @RequestMapping(value = { "/test_web/prefix", "/test-web/prefix" }) public class DeveloperControllerTest { @RequestMapping(value = "/testcfg", method = RequestMethod.POST) @ResponseBody public String setCfg(String command, HttpServletRequest request){ System.out.println("command:" + command); System.out.println("request:" + request); return "hello test"; } @RequestMapping(value = "/mvccfg2", method = RequestMethod.POST) @ResponseBody public String setCfg2(){ return "123"; } // @RequestMapping(value = "/mvccfg3", method = RequestMethod.POST) // public String setCfg3(){ // return "123"; // } }