Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DI Queries

 
Soniya Ahuja
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my current project we are using a lot of Dependency Injection. I need to know

1. When should setter injection be used and when should we go for constructor injection?
2. Should Programming to Interfaces be used always for DI?
3. How can we program to ask our container to inject dependencies for us (kike in Spring)?

Any help appreciated

Thanks in advance.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34084
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
#1 is covered in this thread

#2 - Very few things are "always" true in programming.

#3 - Use Spring?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic