Why Spring Exists

Dependency injection: why a class should be handed its dependencies instead of creating them, shown without Spring first.

  • 5 cards
  • 4 questions
  • About 5 min
  • Beginner
Share

The idea Spring is built on: a class should be handed the objects it depends on instead of creating them itself. A class that creates its own dependencies works until you need to swap one, for a test, a different provider or a stand-in that does not touch the network. It covers the cost of a hard-coded new, Inversion of Control and Dependency Injection, and two examples written by hand with no framework. It leaves Spring itself for the topics that follow it in this subject.

Contents

5 cardsnot started