Announcement Announcement Module
Collapse
No announcement yet.
Best practice for Bean declaration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Best practice for Bean declaration

    Hi,

    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.

    Best Regards,

    ssroy

  • #2
    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.

    Comment

    Working...
    X