Spring abstract="true" merge="true"


abstract="true"

由于设置bean定义中设置了abstract="true",所以Spring容器就不对其进行初始化。

只是在此起了模板的作用,供其他bean继承,所以父bean的属性在类体中可以不定义,直接在bean的声明中以<proerty/>声明即可。

子bean继承他后需要在提供对应的属性和set方法即可,在子bean中就可获取从父bean继承来的值.


   <bean id="baseLocalTxProxy" abstract="true"
        class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
        <property name="transactionManager"
            ref="localTransactionManager" />
        <property name="transactionAttributes">
            <props>
                <prop key="add*">PROPAGATION_REQUIRED</prop>
                <prop key="set*">PROPAGATION_REQUIRED</prop>
                <prop key="new*">PROPAGATION_REQUIRED</prop>
                <prop key="save*">PROPAGATION_REQUIRED</prop>
                <prop key="remove*">PROPAGATION_REQUIRED</prop>
                <prop key="delete*">PROPAGATION_REQUIRED</prop>
                <prop key="update*">PROPAGATION_REQUIRED</prop>
                <prop key="merge*">PROPAGATION_REQUIRED</prop>
                <prop key="modify*">PROPAGATION_REQUIRED</prop>
                <prop key="submit">PROPAGATION_REQUIRED</prop>
                <prop key="list*">PROPAGATION_SUPPORTS,readOnly</prop>
                <prop key="query*">PROPAGATION_SUPPORTS,readOnly</prop>
                <prop key="search*">PROPAGATION_SUPPORTS,readOnly</prop>
                <prop key="load*">PROPAGATION_SUPPORTS,readOnly</prop>
                <prop key="find*">PROPAGATION_SUPPORTS,readOnly</prop>
                <prop key="get*">PROPAGATION_SUPPORTS,readOnly</prop>
            </props>
        </property>
    </bean>

<bean id="shopPickerServiceImpl" parent="baseLocalTxProxy">
        <property name="target">
            <bean class="com.ibm.bpm.wle.module.maindata.biz.impl.ShopPickerServiceImpl"
                autowire="byName">
                <property name="shopPickerDao" ref="shopPickerDaoImpl"></property>
            </bean>
        </property>
        <property name="transactionAttributes">
            <props merge="true">
                <prop key="save*">PROPAGATION_SUPPORTS,readOnly</prop>
                <prop key="list*">readOnly</prop>
            </props>
        </property>
    </bean>

merge="true"

子bean中<prop key="save*">PROPAGATION_SUPPORTS,readOnly</prop>和父bean中的save*相同 那么

子bean会覆盖父bean 的save*.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值