求aspectj 事务处理例子和代码

ccdxjjxy 2009-04-11 10:34:12
求aspectj 事务处理例子和代码
...全文
128 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
matrixjava 2009-05-27
  • 打赏
  • 举报
回复
配置实现:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<aop:aspectj-autoproxy/>

<bean id="judgeInterceptor" class="cc.lotes.mms.common.interceptor.JudgeInterceptor">
<property name="judgeDao" ref="judgeDao"/>
<property name="inEntrepotDao" ref="inEntrepotDao"/>
<property name="judgePeriodicityDao" ref="judgePeriodicityDao"/>
<property name="noService" ref="noService"/>
</bean>

</beans>


java程序实现:
/*
* 新增出库单时失效入库单时
*/
@Pointcut("execution (* cc.lotes.mms.am.service.InEntrepotService.invalidInEntrepot(..))")
public void invalidInEntrepotMethod() {}//声明一个切入点
@After( "invalidInEntrepotMethod()&& args(inEntrepot)")
public void delJudge(InEntrepot inEntrepot){
Judge judge = this.judgeDao.findJudgeByInEntrepotId(inEntrepot.getInEntrepotNo());
if(judge!=null){
judge.setVaild("N");
this.judgeDao.modJudge(judge);
}

}
ccdxjjxy 2009-04-24
  • 打赏
  • 举报
回复
怎么没有人回复呢
ccdxjjxy 2009-04-11
  • 打赏
  • 举报
回复
最好是Aspect5的例子

25,980

社区成员

发帖
与我相关
我的任务
社区描述
高性能WEB开发
社区管理员
  • 高性能WEB开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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