Spring DI - The Good, the Bad and the Ugly • chamindu.dev
Spring is a mature applications development framework for Java. Combined with the power of Spring Boot it is a competitive choice for modern micro-services based application development.
Dependency injection is one of the core services provided by the framework. Spring supports constructor injection and setter injection. Lets take simple example of a hypothetical OrderService class depending on an OrderRepository implementation and discuss the different options available to us.
The Good - Constructor Injection In constructor injection as the name implies we pass dependencies via the constructor.
Spring DI - The Good, the Bad and the Ugly • chamindu.dev
Spring is a mature applications development framework for Java. Combined with the power of Spring Boot it is a competitive choice for modern micro-services based application development. Dependency injection is one of the core services provided by the framework. Spring supports constructor injection and setter injection. Lets take simple example of a hypothetical OrderService class depending on an OrderRepository implementation and discuss the different options available to us. The Good - Constructor Injection In constructor injection as the name implies we pass dependencies via the constructor.
https://www.chamindu.dev/posts/spring-di-good-bad-ugly/