在servlet.xml加入

<aop:aspectj-autoproxy proxy-target-class="true"></aop:aspectj-autoproxy>

sysLogAspectJ

package com.pandy.core.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
* 项目名称: wp_idea_linux
* 功能说明: 在servlet.xml配置: <aop:aspectj-autoproxy proxy-target-class="true" />
* 创建者: Pandy,
* 邮箱: panyongzheng@163.com, 1453261799@qq.com
* 版权:
* 官网:
* 创建日期: 15-11-13.
* 创建时间: 下午9:42.
* 修改历史:
* -----------------------------------------------
*/
@Aspect
@Component
public class ControllerLogAspect {

@Pointcut("within(@org.springframework.stereotype.Controller *)")
public void cutController(){
}

@Around("cutController()")
public Object recordSysLog(ProceedingJoinPoint point) throws Throwable{
System.out.println("=================================ControllerLogAspect执行方法2");
return point.proceed();
}
}

拦截Service等 
在applicationContext.xml(扫描service的类的配置文件)加入

<aop:aspectj-autoproxy proxy-target-class="true"></aop:aspectj-autoproxy>

package com.pandy.core.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
* 项目名称: wp_idea_linux
* 功能说明: 在applicationContext.xml(扫描service的配置文件)配置: <aop:aspectj-autoproxy proxy-target-class="true" />
* 创建者: Pandy,
* 邮箱: panyongzheng@163.com, 1453261799@qq.com
* 版权:
* 官网:
* 创建日期: 15-11-13.
* 创建时间: 下午9:42.
* 修改历史:
* -----------------------------------------------
*/
@Aspect
@Component
public class ServiceLogAspect {

@Pointcut("within(@org.springframework.stereotype.Service *)")
public void cutService(){
}

@Around("cutService()")
public Object recordSysLog(ProceedingJoinPoint point) throws Throwable{
System.out.println("=================================ServiceLogAspect执行方法2");
return point.proceed();
}
}

spring log

http://blog.csdn.net/csh624366188/article/details/7651702/

http://blog.csdn.net/jiankunking/article/details/52244517

http://skyfar666.iteye.com/blog/2008716

最新文章

  1. margin css的外边距
  2. SVN提交提示:working copy is not up-to-date解决方法
  3. WPF:定制Checkbox样式,让“正确”绿得好看,让“错误”红的显眼
  4. 20141211—C#面向对象,封装
  5. springmvc工作原理和环境搭建
  6. BestR #31
  7. 关于Platinum库的MediaRender具体C++代码实现探讨
  8. testNg的安装与卸载
  9. React+Redux学习笔记:React+Redux简易开发步骤
  10. Django-5 模板层
  11. json_encode里面经常用到的 JSON_UNESCAPED_UNICODE和JSON_UNESCAPED_SLASHES
  12. webpack学习笔记--多种配置类型
  13. 创建一个简单的WCF程序2——手动开启/关闭WCF服务与动态调用WCF地址
  14. 软件测试职业规划的思考(转)(作者Findyou
  15. PAT甲题题解-1056. Mice and Rice (25)-模拟题
  16. mapreduce 只使用Mapper往多个hbase表中写数据
  17. 当前上下文中不存在名称&quot;Session&quot;
  18. selenium测试(Java)--截图(十九)
  19. nyoj1007——欧拉求和
  20. Emgu CV的配置以及在VS 2012中进行图像处理的步骤和实例

热门文章

  1. Linux I2C驱动程序设计
  2. Oracle SQL Developer 查询时间格式
  3. 码云+jenkins+自动回复邮件
  4. SpringCloud---服务容错保护---Spring Cloud Hystrix
  5. js验证码有效时间倒计时
  6. vue中$nextTick的用法
  7. [原]SuperMap GIS(JavaScript) 拉框放大和缩小功能实现
  8. (转)Linux-HA开源软件Heartbeat(配置篇)
  9. pycharm安装与使用
  10. LinuxShell脚本编程7-for和while