Back Forum Reply New

Bean initialization order

Hi

Can I set the order of how beans are initialized?

I have some beans depend on the other beans within the applicationcontext, sometimes I get NullPointerException when I startup my app and sometimes it just works.

Thanks


Code:
sometimes I get NullPointerException
Can you post the stack trace and the relevant parts of the application context?

You can specify dependencies between your beens with the quot;depends-onquot; attribute of the quot;beanquot; element. See the DTD for details.

Regards,
Andreas

I have some beans depend on the other beans within the applicationcontextYou can specify dependencies between your beens with the quot;depends-onquot;
NB - You should only need the depends-on attribute if the dependencies are within your code - Spring should resolve dependencies within the application context automatically.
¥
Back Forum Reply New