I joined an existing project who use 2 mechanisms for the front-end with spring mvc:
- A) controllers classes extends org.springframework.web.servlet.mvc.SimpleFormController
- B) controllers classes uses annotation @Controller.
Now I found an interceptor:
@Aspect
public class RequestMonitor {
@Autowired
private RequestMonitorService requestMonitorService;
@Before("execution(* org.springframework.web.servlet.mvc.Controller+.handleRequest(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse))"
+ "&& args(request,response)")
public void storeUserAccess(HttpServletRequest request, HttpServletResponse response) {
requestMonitorService.storeUserAccess(request);
}
}
who catch all requests from org.springframework.web.servlet.mvc.Controller (mechanism A)
How can I adapt to intercept all other controllers with annotations "@Controller": org.springframework.stereotype.Controller (mechanism B)