Hello everyone,
I'm looking for a way to have a method executed before any Handler in a given Controller. Something like
So that when I go to /{x}/handler, for any {x}, I have my "PreDispatch" method invoked, do some processing on x, and than have the regular handler invoked.Code:@Controller @RequestMapping(value = "/{x}") class MyController { @PreDispatch // this is a totally invented annotation just to give you an idea private void aMethod(@PathVariable String x) { ... } @RequestMapping(value = "/handler") public String handler(@PathVariable String x, Model model) { ... } }
Right now, I have all my handlers that execute the "preDispatch" method as the first line of code, and I would like to have this behaviour "automatized".
If there's no way to have this behaviour via SpringMVC probably I have to use AOP.
Thank you very much


Reply With Quote
