Strategy Pattern Revisited With Spring

This blog post demonstrates another approach on how to implement the strategy pattern with dependency injection. As for my DI framework, I choose the Spring Framework:

Image courtesy of Wikipedia

Firstly, let's have a look at how the Strategy Pattern is implemented in a classic way. As a starting point, we have a HeroController that should add a hero in HeroRepository depends on which repository was chosen by the user.