Spring (二) OOP V.S AOP
<!-- 配置sessionFactory --><bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><property name="configLocation"><value>classpath:hibernate.cfg.xml</value></property></bean><!-- 配置事务管理器 --><bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"><property name="sessionFactory"><ref bean="sessionFactory"/></property></bean><!-- 哪些类哪些方法使用事务--><aop:config><aop:pointcut id="allManagerMethod" expression="execution(* com.bjpowernode.drp.service.*.*(..))"/><aop:advisor advice-ref="txAdive" pointcut-ref="allManagerMethod"/></aop:config><tx:advice id="txAdive" transaction-manager="transactionManager"><tx:attributes><tx:method name="add*" propagation="REQUIRED"/><tx:method name="delete*" propagation="REQUIRED"/><tx:method name="modify*" propagation="REQUIRED"/><tx:method name="*" propagation="REQUIRED" read-only="true"/></tx:attributes></tx:advice>