Disadvantages of the setter-based DI

Although the setter-based DI has higher priority than the constructor-based DI, the following are the disadvantages of the former:

  • There is no guarantee in a setter-based DI that the dependency will be injected.
  • One can use a setter-based DI to override another dependency. This can cause security issues in a Spring application.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset