Spring MVC Request mapping, can this be dynamic/configurable?

前端 未结 5 817
慢半拍i
慢半拍i 2021-02-19 06:37

With Spring MVC, I know how you set the RequestMapping in every controller and method/action.

But what if I wanted this to be configurable, so for example I

5条回答
  •  灰色年华
    2021-02-19 07:15

    Try using with @RequestMapping wild cards as below:

    @RequestMapping(value="/article_section*/"}
    public void getArticle(....){
    //TODO implementation
    }
    
    @RequestMapping(value="/blog*/"}
    public void getBlog(....){
    //TODO implementation
    }
    

    Hope this helps!!!

提交回复
热议问题