<!-- 将acctBasicinfoDAO注入到service -->
<bean id="acctBasicinfoServiceTarget"
class="com.acct.service.imp.AcctBasicinfoServiceImp"
singleton="[color=red]false[/color]">
<property name="acctBasicinfoDAO">
<ref local="acctBasicinfoDAO" />
</property>
<property name="businessBean">
<ref local="businessBean" />
</property>
</bean>
<bean id="acctBasicinfoService"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyTargetClass">
<value>true</value>
</property>
<!--告诉proxy可能多个object-->
[color=red]<property name="singleton">
<value>false</value>
</property>[/color]
<!--这里要用value,不能用ref,以便proxy拿到不同的target-->
<property name="target">
<value>acctBasicinfoServiceTarget</value>
</property>
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
</list>
</property>
</bean>
<bean id="transactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributeSource" ref="matchAllWithPropReq" />
</bean>
<bean id="matchAllWithPropReq"
class="org.springframework.transaction.interceptor.MatchAlwaysTransactionAttributeSource">
<property name="transactionAttribute" value="PROPAGATION_REQUIRED" />
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="acctBasicinfoServiceTarget"
class="com.acct.service.imp.AcctBasicinfoServiceImp"
singleton="[color=red]false[/color]">
<property name="acctBasicinfoDAO">
<ref local="acctBasicinfoDAO" />
</property>
<property name="businessBean">
<ref local="businessBean" />
</property>
</bean>
<bean id="acctBasicinfoService"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyTargetClass">
<value>true</value>
</property>
<!--告诉proxy可能多个object-->
[color=red]<property name="singleton">
<value>false</value>
</property>[/color]
<!--这里要用value,不能用ref,以便proxy拿到不同的target-->
<property name="target">
<value>acctBasicinfoServiceTarget</value>
</property>
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
</list>
</property>
</bean>
<bean id="transactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributeSource" ref="matchAllWithPropReq" />
</bean>
<bean id="matchAllWithPropReq"
class="org.springframework.transaction.interceptor.MatchAlwaysTransactionAttributeSource">
<property name="transactionAttribute" value="PROPAGATION_REQUIRED" />
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>