O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Advantages of the setter-based DI

The following are the advantages of the setter-based DI in your Spring application:

  • It's more readable than the constructor injection.
  • This is useful for non-mandatory dependencies.
  • It solves the circular dependency problem in the application.
  • It helps us to inject the dependency only when it is required.
  • It's possible to reinject dependencies. It is not possible in a constructor-based injection.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required