项目中事务配置在action上,execution(* com.XXX.web.action.*.*.*(..)),action中有很多get set 方法,导致get set方法也加入了事务控制,请问有没有简单的办法可以讲get set排除掉?
另外如果按照你们这种方式 可以通过配置的方式显示方法名开头的 如下:
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="modify*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="execute*" propagation="REQUIRED"/>
<tx:method name="*" propagation="REQUIRED" read-only="true"/>
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice>
你们项目真够夸张的,通常都是在在service层进行业务处理事务控制,你们竟然搞到了action层,搞架构的人真有一手.最好分层.增加service层,再有spring进行service层的事务控制,通过ioc的方式在action中引用service多好的.
可以尝试把表达式的类型改为“regex”