做SSH集成,用得是spring的声明式事务和hibernate做的集成。
以下是spring配置文件中关于AOP的配置:
<!-- 配置aop拦截声明类 -->
<bean id = "myAop" class="com.acc.aop.MyAop"></bean>
<aop:config>
<aop:pointcut expression="execution(* com.acc.service.*.*(..))" id="pointCut"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="pointCut"/>
<!-- 配置切面 -->
<aop:aspect id="aspect" ref="myAop">
<aop:after method="after" pointcut-ref="pointCut"/>
<aop:after-returning method="afterReturning" pointcut-ref="pointCut"/>
<!--环绕 -->
<aop:around method="arroundAdvice" pointcut-ref="pointCut"/>
<aop:before method="beforeAdvice" pointcut-ref="pointCut"/>
</aop:aspect>
</aop:config>
之后是从Dao 层 ---》service层----》action层逐层注入的,在action中查询结果集,调用注入在action层中的service层接口,执行数据查询操作时,查询的结果为NUll!!!!
我试了一下把上面配置文件中的<aop:aspect id="aspect" ref="myAop"></sop:aspect>
标签中配置的环绕通知配置项注释掉后,可以查询出结果集.
一下是自定义的aop类中的环绕方法:
public void arroundAdvice(ProceedingJoinPoint pjp){
System.out.println("环绕通知");
try {
pjp.proceed();
} catch (Throwable e) {
e.printStackTrace();
}
}
为什么注释了配置文件中有关于环绕通知的配置后就可以查询出结果集了??
<!--环绕 -->
<aop:around method="arroundAdvice" pointcut-ref="pointCut"/>
不懂了,恳请各位帮忙解决!