|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor
public class SpringBeanAutowiringInterceptor
EJB3-compliant interceptor class that injects Spring beans into
fields and methods which are annotated with @Autowired
.
Performs injection after construction as well as after activation
of a passivated bean.
To be applied through an @Interceptors
annotation in
the EJB Session Bean or Message-Driven Bean class, or through an
interceptor-binding
XML element in the EJB deployment descriptor.
Delegates to Spring's AutowiredAnnotationBeanPostProcessor
underneath, allowing for customization of its specific settings through
overriding the configureBeanPostProcessor(org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor, java.lang.Object)
template method.
The actual BeanFactory to obtain Spring beans from is determined
by the getBeanFactory(java.lang.Object)
template method. The default implementation
obtains the Spring ContextSingletonBeanFactoryLocator
, initialized
from the default resource location classpath*:beanRefContext.xml,
and obtains the single ApplicationContext defined there.
NOTE: If you have more than one shared ApplicationContext definition available
in your EJB class loader, you need to override the getBeanFactoryLocatorKey(java.lang.Object)
method and provide a specific locator key for each autowired EJB.
Alternatively, override the getBeanFactory(java.lang.Object)
template method and
obtain the target factory explicitly.
WARNING: Do not define the same bean as Spring-managed bean and as
EJB3 session bean in the same deployment unit. In particular, be
careful when using the <context:component-scan>
feature
in combination with the deployment of Spring-based EJB3 session beans:
Make sure that the EJB3 session beans are not autodetected as
Spring-managed beans as well, using appropriate package restrictions.
Autowired
,
AutowiredAnnotationBeanPostProcessor
,
ContextSingletonBeanFactoryLocator
,
getBeanFactoryLocatorKey(java.lang.Object)
,
AbstractEnterpriseBean.setBeanFactoryLocator(org.springframework.beans.factory.access.BeanFactoryLocator)
,
AbstractEnterpriseBean.setBeanFactoryLocatorKey(java.lang.String)
Field Summary | |
---|---|
private java.util.Map<java.lang.Object,BeanFactoryReference> |
beanFactoryReferences
|
Constructor Summary | |
---|---|
SpringBeanAutowiringInterceptor()
|
Method Summary | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
void |
autowireBean(InvocationContext invocationContext)
beanFactoryReferencesprivate final java.util.Map<java.lang.Object,BeanFactoryReference> beanFactoryReferences
SpringBeanAutowiringInterceptorpublic SpringBeanAutowiringInterceptor()
autowireBean
doAutowireBeanprotected void doAutowireBean(java.lang.Object target)
configureBeanPostProcessorprotected void configureBeanPostProcessor(AutowiredAnnotationBeanPostProcessor processor, java.lang.Object target)
getBeanFactoryprotected BeanFactory getBeanFactory(java.lang.Object target)
getBeanFactoryReferenceprotected BeanFactoryReference getBeanFactoryReference(java.lang.Object target)
getBeanFactoryLocatorprotected BeanFactoryLocator getBeanFactoryLocator(java.lang.Object target)
getBeanFactoryLocatorKeyprotected java.lang.String getBeanFactoryLocatorKey(java.lang.Object target)
releaseBean
doReleaseBeanprotected void doReleaseBean(java.lang.Object target)
|