Announcement Announcement Module
Collapse
No announcement yet.
Best practise: bootstrap? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Best practise: bootstrap?

    Hello,

    I would like to call a bootstrap method upon application deploiement. What's the best way to do this?

  • #2
    You can add a class implementing BeanFactoryPostProcessor to your context. Implement
    Code:
    postProcessBeanFactory(BeanFactory)
    to post process your bean factory. You can for instance retrieve a bean here and do whatever you want with it.

    BeanFactoryPostProcessors are automtically loaded after the context is created and any singletons have been initialized.

    Comment


    • #3
      If it is a web application you can also use org.springframework.web.context.ContextLoaderListe ner or org.springframework.web.context.ContextLoaderServl et to perform bootstrap initializations. In that case the initialization code is executed only once.
      Using a BeanPostProcessor might be problematic if the configuration is processed more than once (e.g. if you initialize pooled EJBs). In that case your init-code will be executed multiple times.

      Regards,
      Andreas

      Comment

      Working...
      X