Say I have a @RestController
like below:
@RestController
@RequestMapping("/1st")
public class MyController {
@GetMapping("/2nd/aaa")
public void getAaa() {
...
}
@GetMapping("/2nd/bbb")
public void getBbb() {
...
}
}
I want to add methods to catch all requests with the base path "/1st" and "/1st/2nd" in between and then continue to the correct endpoint. I tried adding:
@GetMapping("/**")
public void doThisFirst() {
...
}
But that didn't work, a request to "/1st/2nd/bbb" still only landed on the method getBbb()
only. Please help, thank you.