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";
//    }
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM