Answer the question
In order to leave comments, you need to log in
How to get Spring MVC Method URL?
There are controller methods that are annotated with my annotation. Roughly speaking, I have a list of methods and I need to get the URL of these methods. For example:
@RequestMapping("/test")
@Controller
public class TestController {
@RequestMapping(method = RequestMethod.GET)
public String methodOne(){}
@RequestMapping(value = "/2", method = RequestMethod.GET)
public String methodTwi(){}
}
Answer the question
In order to leave comments, you need to log in
Scan the classpath, get all the classes annotated as @Controller, then walk through the found classes, collect methods annotated with @RequestMapping... that's the magic.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question