PDA

View Full Version : Manage ApplicationContext loading beans



vksoft
Sep 18th, 2004, 09:39 AM
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)

Thanks

Regards

Vu Le

robh
Sep 18th, 2004, 01:39 PM
Vu,

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.

Rob

vksoft
Sep 18th, 2004, 02:46 PM
Rob

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.

Vu