Java Reference
In-Depth Information
<bean id="BeanNameAutoProxyCreator"
class="org.springframework.aop.framework.
bbbbbb b b b autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<idref bean="TransferFacade"/>
</property>
<property name="interceptorNames">
<list>
<idref bean="TransactionInterceptor"/>
</list>
</property>
</bean>
Apply the
TransactionInterceptor
to the TransferFacade
E
</beans>
Let's take a closer look at this listing:
B
This defines a bean called TransferFacade , which is implemented by the Transfer-
FacadeImpl class.
This defines a bean called PlatformTransactionManager , which is implemented by
the HibernateTransactionManager class that manages transactions using the
Hibernate API .
This defines a bean called TransactionInterceptor , which is implemented by the
TransactionInterceptor class that makes an object transactional. Transaction-
Interceptor intercepts calls to the object and calls a PlatformTransactionManager
to begin, commit, and roll back transactions. It has a transactionManager property,
which specifies which PlatformTransactionManager to use, and a transaction-
AttributeSource property, which specifies which methods to make transactional. In
this example, all method calls are configured to be transactional.
C
D
E
This defines a bean called BeanNameAutoProxyCreator , which wraps Transfer-
Facade with TransactionInterceptor . It has an interceptorNames property, which
specifies the list of interceptors to apply, and a beanNames property, which specifies
the beans to wrap with interceptors.
These bean definitions arrange for the bean factory to wrap TransferFacade with
TransactionInterceptor . When the presentation tier invokes what it thinks is
TransferFacade , TransactionInterceptor is invoked instead. The sequence of
events is shown in figure 1.6.
 
 
 
Search WWH ::




Custom Search