Skip to content

Latest commit

 

History

History
23 lines (12 loc) · 965 Bytes

File metadata and controls

23 lines (12 loc) · 965 Bytes

Strategy (and Factory) pattern with dependency injection

Lot of options for how to implement Strategy Pattern with dependency injection using Spring.

Problem

Given an enum, we need follow a determined flux in application and to return always the same object type.

We would like of a dynamic and uncoupled solution (obviously).

The exciting part of the history is that each strategy is a Bean (the project uses Spring).

Solution

We think about use Strategy Design Pattern.

For this reason, we have built several strategies with the objective can choose dynamicly the Bean.

See the options.

Which is the best implementation? Some suggestion?

🤘