熟悉Spring的大大们进啊

voacom 2009-09-14 09:09:07
我在配置Spring的时候,想配置两个切面
<aop:config>
<aop:pointcut id="allManageMethod"
expression="execution(* com.lhq.prj.bms.service.impl.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod"/>
</aop:config>
这是其中的一个切面
我还想配置另一个切面为 * com.czccb.bmsh.service.impl.*.*(..) 该怎么配置啊,是不是就像下面这样啊
<aop:config>
<aop:pointcut id="allManageMethod1"
expression="execution(* com.lhq.prj.bms.service.impl.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod1"/>
<aop:pointcut id="allManageMethod2"
expression="execution(* com.czccb.bmsh.service.impl.*.*(..)"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod2"/>
</aop:config>

这样行不行啊,还是需要别的配置方法啊,大家帮帮我啊,谢谢了
...全文
120 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
猿敲月下码 2009-09-14
  • 打赏
  • 举报
回复
或许可以换一种事务管理方式
EM265 2009-09-14
  • 打赏
  • 举报
回复
你上面的配置只是顺序的问题!其实你要是稍微看一下提示的话,你就明白了
<aop:config>
<aop:pointcut id="allManageMethod1"
expression="execution(* com.lhq.prj.bms.service.impl.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod1"/>
<aop:pointcut id="allManageMethod2"
expression="execution(* com.czccb.bmsh.service.impl.*.*(..)"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod2"/>
</aop:config>
修改成
<aop:config>
<aop:pointcut id="allManageMethod1"
expression="execution(* com.lhq.prj.bms.service.impl.*.*(..))"/>
<aop:pointcut id="allManageMethod2"
expression="execution(* com.czccb.bmsh.service.impl.*.*(..)"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod1"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod2"/>
</aop:config>

你先这样试试看吧!

62,621

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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