Junior — Middle
Is it possible to assign multiple URLs to a single method annotated with @RequestMapping?
sobes.tech AI
Answer from AI
Yes, in the Spring Framework, you can assign multiple URLs to a single method annotated with @RequestMapping by using an array of values in the value or path attribute. For example:
@RequestMapping(value = {"/url1", "/url2"})
public String handleMultipleUrls() {
return "response";
}
Thus, the method will handle requests for both URLs.