Announcement Announcement Module
Collapse
No announcement yet.
How to decide which class will be Spring Bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to decide which class will be Spring Bean

    Hi,

    I am new to Spring and I think I understood inversion of control , and I can understand simple projects (mostly related to the DAO). But when I need to decide which classes to be Spring Bean, the only ones that come in mind are
    DAO classes (because of DataSource injection).

    Can you please help me and explain how I decide which classes should be Spring Beans (in spring repository). Is there some heuristics about this?

    Thank you very much,
    Yanna

  • #2
    What kind of project are you building?

    The beauty is that any object can be a spring bean. If you program towards interfaces, then you can nicely do the wiring of your objects using spring.

    In a standalone app for instance, you only need to instantiate the spring context (ApplicationContext). From there spring instantiates all your dependencies.

    Comment

    Working...
    X