Announcement Announcement Module
No announcement yet.
Where is BeanFactoryPostProcessor in creation sequence? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Where is BeanFactoryPostProcessor in creation sequence?

    I am curious to understand the exact sequence of events in creating a BeanFactory (or ApplicationContext) and where BeanFactoryPostProcessor fits in.

    The ref document says the purpose of a BeanFactoryPostProcessor is
    to apply changes of some sort to an entire BeanFactory, after it has been constructed.
    but I'm not sure what 'constructed' means in this context.

    I have written a BeanFactoryPostProcessor that initializes some static fields in a class that my application uses (see

    If any objects of this class were instantiated in the course of building the factory, it would be important that this initialization took place first. In the (limited) experimentation I've done, this seems to be so.

    Is this the case? Do BeanFactoryPostProcessors run before the instantiation of any beans? In which case, what does 'construction' of the bean factory mean?
    In other words, what does the 'Post' in BeanFactoryPostProcessor refer to?
    Last edited by robyn; May 14th, 2006, 09:05 PM.

  • #2
    According to the source, they get called long before the singletons get instantiated. See refresh() in AbstractApplicationContext class.


    • #3
      Thanks. The sequence seems to suit my needs.