--监控com.zte..hibernate3impl.*Impl 这个包下面的所有文件的所有方法,配置了一个事物
<aop:advisor pointcut="execution(* com.zte..hibernate3impl.*Impl.*(..))" advice-ref="txAdvice" />
<bean id="dbCallMonitor" class="com.zte.frame.web.servlet.DbCallMonitor" />
<aop:config>
<aop:pointcut id="around"
expression="execution(* com.zte..hibernate3impl.*Impl.*(..))" />
<aop:aspect ref="dbCallMonitor">
<aop:around method="around" pointcut-ref="around" /> --这个around是对上面的around的引用
</aop:aspect>
</aop:config>
<property name="proxyTargetClass" value="false" />
public class DbCallMonitor {
protected final Logger log = Logger.getLogger(DbCallMonitor.class);
public Object around(ProceedingJoinPoint pjp) throws Throwable {
synchronized (this) {
Class<?> targetClass = pjp.getTarget().getClass();
MethodSignature sign = (MethodSignature) pjp.getSignature();
String method = sign.getMethod().getName();
String clazz = targetClass.getName();
StopWatch stopWatch = new Log4JStopWatch(clazz + "."
+ method);
// 构建数据入库
Object obj = null;
try {
long begin = System.currentTimeMillis();
obj = pjp.proceed();
long end = System.currentTimeMillis();
// 构建数据
DbCallMonitorSingleton.getInstance().buildData(clazz, method, end - begin);
} catch (Throwable ex) {
log.error("DbCallMonitor Exception : ", ex);
throw ex;
}
stopWatch.stop();
return obj;
}
// 将查询出的对象剔除事务,已确保不会被Hibernate事务自动更新
if(null != d) {
this.getSession().evict(d);
}
相关推荐
spring AOP切面编程 运行环境:eclipse 构建工具:maven 不提供maven构建,maven用来解决jar包的依赖
Spring 动态代理和aop切面编程例子,自己写的例子!!!!!!!
学习Spring开发的AOP面向切面编程时所需要的jar包,包括com.springsource.net.sf.cglib-2.2.0.jar com.springsource.org.aopalliance-1.0.0.jar com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar
AOP面向切面编程实例,可当作业提交。.net代码亲测,完全正确运行。
实现spring的aop的操作,采用AspectJ技术,通过xml的配置来实现,本人亲自测试过,aop相关架包已引入
最近公司要求和别的公司对接,但是不想破坏原有的架构,就只有用切面了,百度了下都不全面,就自己写了个小demo,只要导入spring4.2.3的jar就直接可以用,注解实现spingaop机制,1分意思下
AOP面向切面编程.ppt
Spring mvc mybatis plus 实现AOP 切面日志系统,带有数据库。可以自行拓展
一直对AOP面向切面编程的理解很模糊的同学可以看看。
JAVA简单AOP切面编程;依赖注入;代码配置Bean源码 JAVA简单AOP切面编程;依赖注入;代码配置Bean源码
Spring-aop面向切面编程实例 日志系统,权限控制等.
aop切面拦截单个方法实例
通过模拟SpringAOP,设置四个Advice实现简单的切面编程
Spring,面向切面编程AOP例子!AOP(Aspect Oriented Programming)!
aop 面向切面编程 demo,通过一个小案例来讲解,aop在andriod开发中运用
2、面向切面编程AOP 在实现过程中,我尽量贴近实际开发与场景,麻雀虽小,五脏俱全,个人感觉这个项目是web框架搭建的一个极简之道实践。 项目中可能还存在很多的问题,希望大家不吝赐教,谢谢。
aop,面向切面编程
spring xml 实现aop切面编程 内附注释,希望对入门的新手有帮助
spect Oriented Programming(AOP),面向切面编程,是一个比较热门的话题。AOP主要实现的目的是针对业务处理过程中的切面进行提取,它所面对的是处理过程中的某个步骤或阶段,以获得逻辑过程中各部分之间低耦合性的...
Spring中的AOP代理还是离不开Spring的IOC容器,代理的生成,管理及其依赖关系都是由IOC容器负责,Spring默认使用JDK动态代理,在需要代理类而不是代理接口的时候,Spring会自动切换为使用CGLIB代理,不过现在的项目...