Is it possible to dynamically set RequestMappings in Spring MVC?

后端 未结 6 1816
心在旅途
心在旅途 2020-12-04 13:31

I\'ve been using Spring MVC for three months now. I was considering a good way to dynamically add RequestMapping. This comes from the necessity to put controller parts in a

6条回答
  •  鱼传尺愫
    2020-12-04 14:09

    @RequestMapping(value = "/bla/{myParam1}", method = RequestMethod.GET)
    public String media(@PathVariable("myParam1") String myParam1, HttpServletRequest request, HttpServletResponse response) {
        return "bla/" + myParam1;
    }
    

提交回复
热议问题