Spring+hibernate+springmvc 整合(三)

B)application.xml文件


 


<!--  扫描注解 -->


  <context:component-scan base-package="*"> 


         <context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation"/>


</context:component-scan>


<!--  定义注解事务支持  -->


<tx:annotation-driven  transaction-manager="transactionManager"/>


<!-- aop 支持 -->


<aop:config>


<aop:pointcut id="serviceOperation"


expression="execution(* org.pp..*.*(..))"/>


<aop:advisor pointcut-ref="serviceOperation" advice-ref="txAdvice"/>


</aop:config>


<tx:advice id="txAdvice">


<tx:attributes>


<tx:method name="get*" read-only="true"/>


<tx:method name="find*" read-only="true"/>


<tx:method name="*" propagation="REQUIRED" />


</tx:attributes>


</tx:advice>


<!--  旧系统 配置-->


<bean id="transactionBase"


        class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"


        lazy-init="true" abstract="true">


        <property name="transactionManager" ref="transactionManager" />


        <property name="transactionAttributes">


            <props>


            <prop key="create*">PROPAGATION_REQUIRED</prop>


                <prop key="update*">PROPAGATION_REQUIRED</prop>


                <prop key="delete*">PROPAGATION_REQUIRED</prop>


                <prop key="merge*">PROPAGATION_REQUIRED</prop>


                <prop key="list*">PROPAGATION_REQUIRED,readOnly


                </prop>


                <prop key="get*">PROPAGATION_REQUIRED,readOnly


                </prop>


                <prop key="*">PROPAGATION_REQUIRED</prop>


            </props>


        </property>


    </bean>


你可能感兴趣的:(Spring+hibernate+springmvc 整合(三))