Hi,
I would like to know how I can consolidate many of my beans that use the same property. For example, I have about 10 DAOs that are defined that use the same sessionFactory property, e.g.
###############
<bean id="customerDAO" class="com.test.persistence.orm.hibernate.Hibernat eCustomerDAO">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="accountDAO" class="com.test.persistence.orm.hibernate.Hibernat eAccountDAO">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
....
..
... // 8 more DAOs just like above
################
I know consolidation is possible but have not seen an example on the Web on how this would be done.
Also, can I consolidate transaction proxy beans that use the same transaction manager + transaction attributes on different service beans? For example, can I consolidate the below 2 beans into 1?:
################
<bean id="customerServiceTX" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
<property name="transactionManager" ref="hibernateTxManager"/>
<property name="target" ref="customerService"/>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean id="accountServiceTX" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
<property name="transactionManager" ref="hibernateTxManager"/>
<property name="target" ref="accountService"/>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
###############################
I actually have 6 definitions of these beans in my app so consolidation would be nice.
Thanks in advance!
-los


Reply With Quote
