Results 1 to 2 of 2

Thread: How to decide which class will be Spring Bean

  1. #1
    Join Date
    Aug 2008
    Posts
    7

    Default 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. #2
    Join Date
    Dec 2007
    Location
    Belgium
    Posts
    24

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •