<!--事务相关控制--> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"></property> </bean> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="add*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> <tx:method name="delete*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> <tx:method name="modify*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> <tx:method name="update*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> <tx:method name="find*" read-only="true"/> <tx:method name="get*" read-only="true"/> <tx:method name="select*" read-only="true"/> </tx:attributes> </tx:advice> <!--把事务控制在Service层--> <aop:config> <aop:pointcut id="pc" expression="execution(public * com.test.service.*.*(..))" /> <aop:advisor pointcut-ref="pc" advice-ref="txAdvice" /> </aop:config>
execution(* com.aptech.jb.epet.dao.hibimpl.*.*(..))
这样写应该就可以了 这是com.aptech.jb.epet.dao.hibimpl 包下所有的类的所有方法。。
- com.tiema.role.service //存了接口
- com.tiema.role.service.impl //存了接口实现类
- com.tiema.user.service //接口
- com.tiema.user.service.impl //实现类
- com.tiema.dept.service //接口
- com.tiema.dept.service.impl //实现类
- com.tiema.company.service //接口
- com.tiema.company.service.impl //实现类
execution(* com.tiema.*.service..*(..))"