XML でこれと同等の Bean を resources.groovy に作成しようとしています:
<bean id="txProxyTemplate" abstract="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager" />
<property name="target" ref="genericHibernateDAO" />
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<!--prop key="analyze">PROPAGATION_REQUIRED</prop -->
<prop key="validate">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
<prop key="create*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="clear*">PROPAGATION_REQUIRED</prop>
<prop key="set*">PROPAGATION_REQUIRED</prop>
<prop key="reinitialize">PROPAGATION_REQUIRED</prop>
<prop key="zap*">PROPAGATION_REQUIRED</prop>
<prop key="turn*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
次に、この抽象 Bean を親として使用する 2 番目の Bean:
<bean id="myCoolService" parent="txProxyTemplate">
<property name="target">
<bean
class="com.fourgablesguy.myapp.MyCoolService">
</bean>
</property>
</bean>
これまでのところ、これは私がresources.groovyに持っているものです:
import org.springframework.transaction.interceptor.TransactionProxyFactoryBean
import com.fourgablesguy.myapp.MyCoolService
beans = {
txProxyTemplate(TransactionProxyFactoryBean) {
transactionManager = ref('transactionManager')
target = ref ('genericHibernateDAO')
transactionAttributes = [
"save*":"PROPAGATION_REQUIRED",
"validate":"PROPAGATION_REQUIRED",
"remove*":"PROPAGATION_REQUIRED",
"create*":"PROPAGATION_REQUIRED",
"delete*":"PROPAGATION_REQUIRED",
"add*":"PROPAGATION_REQUIRED",
"clear*":"PROPAGATION_REQUIRED",
"set*":"PROPAGATION_REQUIRED",
"reinitialize":"PROPAGATION_REQUIRED",
"zap*":"PROPAGATION_REQUIRED",
"turn*":"PROPAGATION_REQUIRED",
"*":"PROPAGATION_REQUIRED"
]
}
myCoolService(MyCoolService) {
}
}
txProxyTemplate Bean を抽象化して myCoolService Bean を設定し、txProxyTemplate Bean を親として、myCoolService Bean をターゲットとして設定する方法がわかりません。