May 11th, 2006, 03:38 AM
Binding BeanFactoryPostProcessors to a single bean factory
im loading my application context using the ContextLoaderListener. The application context is combined by several seperated bean definition xmls.
All bean definition files contain a PropertyPlaceHolderConfigurer (BeanFactoryPostProcessor) with different property sources.
It seems loading the whole application context using the listener executes all configurers in sequence on all loaded xml files (so to say the whole application context).
What i need to do is, to bind a specific BeanFactoryPostProcessor only the the bean definition xml it is contained in.
Does anyone have a simple solution for such a problem. And furthermore do you think it would be a nice feature to have in future releases of the spring-framework ?
May 27th, 2006, 09:40 AM
BeanFactoryPostProcessor are applied to the BeanFactory rather than the containing xml file.
I can think of two solutions to work arround this:
- refactor out your configuration into a parent - children factories and have BFPPs defined in the children files.
- inject the names of the beans to be processed into the BFPP implementation and add a test in postProcessBeanFactory.