1.配置spring事务模板bean

    <!--spring 模板事务-->
    <bean id="transactionProxy" abstract="true"
        class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
        <property name="transactionManager" ref="TransactionManager" />
        <property name="transactionAttributes">
            <props>
                *****
            </props>
        </property>
    </bean>

2.事务服务bean的配置

  <bean id="xxxxDAO" class="com.xxxx.xxxxDAOImpl">
    <property name="sessionFactory" ref="sessionFactory" />
  </bean>
  <bean id="xxxxServiceTarget" class="com.xxxx.xxxxServiceImpl" parent="service">
    <property name="xxxxDAO" ref="xxxxDAO" />
  </bean>
  <bean id="xxxxService" parent="transactionProxy">
    <property name="target" ref="xxxxServiceTarget" />
  </bean>

使用占位符配置bean的方法:

    <bean id="placeholderConfig"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>
                    ***.properties
                </value>
                <value>
                   ***.properties
                </value>
            </list>
        </property>
    </bean>

posted on 2013-01-22 15:48  一天不进步,就是退步  阅读(550)  评论(0编辑  收藏  举报