Daily Archives: September 28, 2020

1 post

How to customize dependency injection in Spring

How to customize dependency injection in Spring (Part 2)

I believe that the decorator pattern is one of the most powerful design patterns out there. It is the rule “composition > inheritance” at it’s best: it makes your classes easily testable, it allows to decompose huge classes into smaller ones, and it makes your code reusable and modular. In fact, Spring Framework relies heavily on this pattern. Unfortunately, I think that Spring doesn’t provide a really convenient way to configure decorators with it. This is the second part of how to customize dependency injection in Spring, and today we’re going to see how to make Spring’s DI respect decorators.

Continue reading