java spring3注释basec控制器与日志记录
我正在使用 java 和 spring3 我有以下控制器的服务方法
@Override
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
}
我有以下方法为每个方法执行日志记录,我想为每个服务方法调用此方法
public void performLog(HttpServletRequest request){
//process params and log msg
log.debug()
}
请告诉我如何在服务方法之后自动调用 PerformLog(request) 方法?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须使用 Spring AOP。使用 @Before 注释指定必要的切入点。将此方法放置在用 @Aspect 注释的类中。 类似于切入点示例的内容
可以找到 此处
检查此处了解更多信息
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