Java Reference
In-Depth Information
8.4.3
PlaceOrderService configuration
The servlets and JSP pages are not the only part of the design that is independent
of the persistence framework. There are also the Spring beans that configure the
PlaceOrderService . The PlaceOrderService is wrapped with two interceptors. First
is the TransactionRetryInterceptor , which retries the transaction if it is rolled
back because of a database concurrency failure, and the second is Spring's Trans-
actionInterceptor . Listing 8.2 shows the definitions of the PlaceOrderService ,
TransactionInterceptor , TransactionRetryInterceptor , and PlaceOrderService-
ProxyCreator beans.
Listing 8.2
placeOrderService-exposedDomain-beans.xml
<beans>
<bean id="PlaceOrderService"
class="net.chrisrichardson.foodToGo.domain.PlaceOrderServiceImpl">
<constructor-arg ref="RestaurantRepositoryImpl"/>
<constructor-arg ref="PendingOrderRepositoryImpl"/>
</bean>
<bean id=" PlaceOrderServiceProxyCreator "
class="org.springframework.aop.framework.autoproxy.
bbbbbb b BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<idref bean="PlaceOrderService" />
</list>
</property>
<property name="interceptorNames">
<list>
<idref bean="TransactionRetryInterceptor" />
<idref bean="TransactionInterceptor" />
</list>
</property>
</bean>
<bean id="TransactionInterceptor"
class="org.springframework.transaction.interceptor.
bbbbbb b TransactionInterceptor">
<property name="transactionManager" ref="myTransactionManager"/>
<property name="transactionAttributeSource">
<value>
net.chrisrichardson.foodToGo.domain.PlaceOrderService.*=
bbb bb PROPAGATION_REQUIRED
</value>
</property>
 
 
 
Search WWH ::




Custom Search