Hands-On High Performance with Spring 5
上QQ阅读APP看书,第一时间看更新

Disadvantages of the constructor-based DI

The only disadvantage of the constructor-based injection is that it may cause circular dependency between objects. Circular dependency means two objects depend on each other. For resolving that, we should use a setter injection instead of a constructor injection.

Let's see a different type of DI in Spring, which is a setter-based injection.