I am using java with spring3 i have following controller’s service method
@Override
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
}
I have the following method which performs logging for every method, i want to call this method for every service method
public void performLog(HttpServletRequest request){
//process params and log msg
log.debug()
}
Please tell me how can i call performLog(request) method after service method automatically ?
You would have to use Spring AOP for it . Use an @Before annotation specifying the necessary pointcut . Place this method in a class annotated with @Aspect . Something similar to
Pointcut samples can be found here
Check here for more info