Results 1 to 3 of 3

Thread: Best practise: bootstrap?

  1. #1
    Join Date
    Aug 2004
    Location
    Los Angeles, USA
    Posts
    62

    Default Best practise: bootstrap?

    Hello,

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

  2. #2
    Join Date
    Aug 2004
    Location
    Amsterdam, Netherlands
    Posts
    450

    Default

    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.
    Alef Arendsen
    SpringSource
    http://www.springsource.com

  3. #3
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    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

Similar Threads

  1. Best practise Spring Bean initialisation with JSF
    By Johannes Hiemer in forum Web
    Replies: 0
    Last Post: Jul 11th, 2005, 04:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •