Announcement Announcement Module
Collapse
No announcement yet.
BeanPostProcessors / BeanFactoryPostProcessors extending to child contexts Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BeanPostProcessors / BeanFactoryPostProcessors extending to child contexts

    Hello,

    I would like to have a context that contains definitions for global BeanPostPostprocessors and BeanFactoryPostProcessors. Currently if you have child contexts the Bean(Factory)?PostProcessors don't process any of the child contexts beans. This is problematic because I have some global processors that I would like to process all the beans in the hierarchy.

    Of course I could just make a processors.xml context file and import that to child contexts, but I would really like the possibility of doing this transparently.

    The problem is spring-webflow which we are using and currently we have over 60 spring-contexts files for the very complex flows we have and adding that import to everyone of those is error-prone and tedious.

    Any ideas or help ?

    Cheers,

    Jukka

  • #2
    I think you are out of luck with the post processors. I'm not even sure if it's possible to list beans from a child context (I can't immediately see how to do it).

    Comment


    • #3
      Originally posted by david_syer
      I think you are out of luck with the post processors. I'm not even sure if it's possible to list beans from a child context (I can't immediately see how to do it).
      Well, I wrote a little root context ApplicationListener that listened ContextRefreshedEvent (which also signals a new context creation), and with that I could see all the beans created in the child contexts, but unfortunately only after their instantiation. So there is a way to get the informatio to parent context but after child context creation .

      I would like the spring framework to support some kind of scheme to make it possible for these two special case beans to process the child contexts too. Of course a place for hookup in the BeanFactory creation process would be as fine too, so after the bean defition reading and before the bean instantiation.

      Cheers,

      Jukka

      Comment


      • #4
        You could ask the question on the mailing list - AFAIK, you'll have to manually add such functionality yourself. The problem is that each context (child or not) has an independent lifecycle from the parent to some extent. For example one can create context A and then create a child B (which relies on A) but this will not influence A - one can later on stop B but A will still work.
        This translates to post processors also - they are available only inside the context in which they are declared. Raise an issue on JIRA about global post processors (along with the problem you have encountered).

        Comment

        Working...
        X