-
Dec 8th, 2010, 12:09 PM
#1
AnnotationContextAware and AutowireCapableBeanFactory
hi,
I've got a couple of classes implementing ApplicationContextAware. I create my objects by myself and pass them to the autowireBean- Method in an AutowireCapableBeanFactory. Doing so, the setApplicationContext()- Method is never called. It is possible to get an application context by creating a field of type ApplicationContext and annotate it with @autowired.
I guess that's because autowireBean() performs autowiring only and an Interface is no autowiring.
(1) Is my guess correct?
(2) Is there any chance to make spring call setApplicationContext() on an object not created by the container?
-
Dec 9th, 2010, 02:02 AM
#2
1) No
2) No
The ApplicationContextAware is a marker interface which is called after bean construction by a BeanPostProcessor, as you are instantiating beans yourself the initialization and BeanPostProcessors aren't called for your beans.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules