I'd like to do @CustomFilter annotation in Spring 3 mvc like this:
@CustomFilter
@RequestMapping("/{id}")
public Account retrieve(@PathVariable Long id) {
// ...
}
(Assuming upgrading to Spring 4 is constrained) What I have to do at the moment with Spring 3 looks like this:
public class CustomFilter implements Filter {
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
HttpServletRequest request = (HttpServletRequest) req;
....
chain.doFilter(req, res);
}
}
My question is: How to do a @CustomAnnotation annotation that triggers a Filter in Spring 3 MVC?