Dependency injection is at the core of the Spring framework and recognizing it in all of its forms is important when reading source code. In this video, Kevin Bowersox introduces three approaches to dependency injection in Spring: field injection, setter injection, and constructor injection. Using the Spring Tool Suite, Spring beginners will learn the advantages and disadvantages of each approach in a variety of situations.

Upgrade your skills with Building Microservices with Spring.

Kevin Bowersox has built Java web applications for the past eight years. Completing his master’s degree at the University of Pennsylvania, Kevin adopted modern frameworks such as Spring and Hibernate as his main specialties. Kevin now leads a team of developers, and has developed several frameworks for use by internal development teams.

Article image: Screen from "How should I inject dependencies in Spring?" (source: O'Reilly).