Dependency Injection

  • Spring has another approach to this problem
  • Spring encourages approach 2 (to allow for using interfaces)
  • Passes dependencies to your class either by the constructor or setters
  • Handles constructing dependency classes for you
  • If a class is dependent on an interface, figures out which class implements the interface

26 / 27