spring mvc requestmapping 配置多个
Posted jihite
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了spring mvc requestmapping 配置多个相关的知识,希望对你有一定的参考价值。
参考
package com.alibaba.iucheck.gdstoredis.web.controllers; 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"; // } }
以上是关于spring mvc requestmapping 配置多个的主要内容,如果未能解决你的问题,请参考以下文章
spring mvc requestmapping 配置多个
Spring MVC 基础注解之@RequestMapping@Controller
Spring Security + MVC:相同的@RequestMapping,不同的@Secured