Jun 3rd, 2010, 08:28 AM
Best practice for Bean declaration
What is the best practice for bean declaration i.e., should all classes be declared as bean or any specific set of classes. Declaring all classes as bean will clutter the application context.
Any suggestion will be greatly appreciated.
Thanks a lot.
Aug 6th, 2010, 10:33 AM
In spring, DI & IoC can say more about "WHY TO DECLARE A CLASS AS A BEAN?".
Just consider that, declaring any class as a bean means that class is given to the spring to handle its object creations and handling.
I would prefer to declare all classes as a bean if 'The Spring' is your primary playground of development.
In case if a class is static or its intended to provide static functionality, then it can be avoided to be declared as a bean.