I have a controller class
@RestController
public class Controller {
@GetMapping("endpoint")
public void endpoint() {
}
}
and need the reference to the method handling the request i.e. Controller#endpoint().
I'm not looking for obtaining a reference to the current method but rather assume I'm in a filter or service for example and I need a reference to the endpoint method.
(The ultimate goal is to then assess wheter @SomeRelevantAnnotation is present or not deep inside my custom spring security stack but that's out of scope for this question.)
I think I could use the RequestContextHolder instance which embedds the request instance that I can then use in HandlerMapping#getHandler(request) to get a reference to the method.
Is there an easier way?