<bean id="aService" parent="transactionProxy">
<property name="target" >
<bean class="AServiceImpl">
<property name="aDao" ref="aDao" />
</bean>
</property>
</bean>
当应用从应用上下文里请求一个<span style="font-family: Arial, Helvetica, sans-serif;">aService时,它将得到一个被</span><span style="font-family: Arial, Helvetica, sans-serif;">TransactionProxyFactoryBean包裹的实例,(原来的</span><span style="font-family: Arial, Helvetica, sans-serif;">aService对象应该被重命名,否则对象的id冲突),target指向</span><span style="font-family: Arial, Helvetica, sans-serif;">AServiceImpl。即<span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 20.799999237060547px;">在父类中有一个target属性,这个</span></span><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 20.799999237060547px;">target属性类似于</span><span style="font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 20.799999237060547px;">ProxyFactoryBean的</span><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 20.799999237060547px;">target属性-代理的目标对象:</span>
<span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 20.799999237060547px;"></span><pre name="code" class="html"> <property name="target" >
<pre name="code" class="java"><span style="white-space:pre"> </span><ref bean="<span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;">aServiceT</span><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;">arget</span>"/>
</property>
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 20.799999237060547px;">所以给这个对象赋予class指定类的对象。</span></span>
<bean id="transactionProxy" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="add*">PROPAGATION_REQUIRED,ISOLATION_DEFAULT,-tion</prop>
<prop key="*">PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly,-tion</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<pre name="code" class="html"> <bean id="aDao" class="ADaoImpl">
<property name="sqlMapClientTemplate">
<ref bean="sqlMapClientTemplate"/>
</property>
</bean>
<!-- Spring iBatis SqlMapClient -->
<span style="white-space:pre"> </span><bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="classpath:sqlMapConfig.xml"/>
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- Spring iBatisTemplate -->
<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<property name="sqlMapClient">
<ref bean="sqlMapClient"/>
</property>
</bean>