Results 1 to 3 of 3

Thread: Skip loading bean into context

  1. #1
    Join Date
    Mar 2006
    Posts
    12

    Default Skip loading bean into context

    Hi,
    is there a way to influence loading of beans into application context, say, based on bean name, so that certain beans are loaded at startup, and other are not loaded (at startup, or any other time)?

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

    Default

    You can set the "lazy-init" attribute to "true" to prevent eager initialization of singletons.
    However, you cannot prevent to retrieve a bean at all. If that would be required, then why did you place it in the config in the first place?

    Regards,
    Andreas

  3. #3
    Join Date
    Mar 2006
    Posts
    12

    Default

    thanks for the reply, I ended up using InstantiationAwareBeanPostProcessor, the reason I needed this in the first place is because one of my requirements is that the same application exists in different environments -- being lazy I did not want to write two sets of configuration xml's, but based on one (property) setting, I was worried that beans from irrelevant set would be loaded/initialized, but i circumvented that using InstantiationAwareBeanPostProcessor; thanks...

Posting Permissions

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