后通知怎么实现

wanlinghai 2010-07-07 03:21:26
后通知怎么实现
...全文
110 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
coooliang 2010-07-07
  • 打赏
  • 举报
回复
mark
  • 打赏
  • 举报
回复
不知所云!
JerryZhou_ 2010-07-07
  • 打赏
  • 举报
回复
汗 没听过 学习了...
jklzhou 2010-07-07
  • 打赏
  • 举报
回复
学习!
guo624587253 2010-07-07
  • 打赏
  • 举报
回复
路过,学习中
cooljia 2010-07-07
  • 打赏
  • 举报
回复
囧,请结贴给分。。
wanlinghai 2010-07-07
  • 打赏
  • 举报
回复
谢了~
cooljia 2010-07-07
  • 打赏
  • 举报
回复
后通知必须实现AfterReturningAdvice 接口,例如:

public class CountingAfterReturningAdvice implements AfterReturningAdvice {
private int count;
public void afterReturning(Object returnValue, Method m, Object[] args, Object target)
throws Throwable {
++count;
}
public int getCount() {
return count;
}
}
cooljia 2010-07-07
  • 打赏
  • 举报
回复

<aop:aspect id="afterReturningExample" ref="aBean">
<aop:pointcut id="businessService"
expression="execution(* com.xyz.myapp.service.*.*(..))"/>

<aop:after-returning
pointcut-ref="dataAccessOperation"
method="doAccessCheck"/>

...

</aop:aspect>

wanlinghai 2010-07-07
  • 打赏
  • 举报
回复
<aop:config>
<!-- 定义切入点 -->

???怎么写?
<!-- 关于事务边界的设置,通常设置到业务层 -->
<!-- 指定具体的包的路径 ........ -->
<aop:pointcut id="myPointCut" expression="execution(* com.vance.service.impl.*.*(..))"/>

<!-- 定义通知位置 -->
<aop:advisor advice-ref="myAdvice" pointcut-ref="myPointCut"/>
</aop:config>
wanlinghai 2010-07-07
  • 打赏
  • 举报
回复
有具体的列子吗?
dushouxian 2010-07-07
  • 打赏
  • 举报
回复
通过代理呗
zidasine 2010-07-07
  • 打赏
  • 举报
回复
去看aop

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧