Announcement Announcement Module
No announcement yet.
Manage ApplicationContext loading beans Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Manage ApplicationContext loading beans

    Hello all

    Congratulation to the Spring Framework Team on a new release. Great works.

    I have 2 questions related to how Spring initializes and loads beans using an ApplicationContext class

    1. Is there a way to globally (I couldn't find it in a DTD) set lazy initialization to true for all beans in all context xml files?

    2. Is there a way to stop loading beans when a first error is encountered in context xml files? (for instance, a database is down)



    Vu Le

  • #2

    In answer to your first question, you can set the default-lazy-init attribute of the beans tag to configure default initialization behavior. As for your second question - there is, as far as I am aware, no way to control the way Spring handles errors during bean loading - one of the other members of the team may be able to correct me here, but I haven't found any option to control this.



    • #3

      thanks for your answer. As for my second question, it would be nice if I can register a handler to intercept when there is an error loading beans in context xml files. I think this feature is helpful to proactively handle configuration errors. In my case, if the database is down, there is no need to continue loading the rest of our components. I simply want to notify someone or take appropriate actions.