title: Strategy Pattern using java 8 and service injection
body: <p>I'm trying to implement the Strategy Pattern for some custom validation that doesn't involve only validation input with basic operations but I do need to call some other services to validate the data.</p>
  
  <p>At the beginning I used the example mentioned <a href="https://dzone.com/articles/validations-using-enum" rel="nofollow noreferrer">here</a> which uses enums to have different strategies but of course it was not possible to inject my services in the enum so now I'm looking at <a href="https://www.baeldung.com/java-strategy-pattern" rel="nofollow noreferrer">this</a> that leverages to java 8 for more clarity.</p>
  
  <p>My idea is to have an interface with has one method <code>validate()</code> and have generic input for different objects I could send it and then a class implementing that interface that would have different validations based on object type and dispatches requests to different services, but on the other hand I'm kinda loosing the enum advantage on having different strategies which I could select for instance based on specific user settings.</p>
  
  <p>Any idea how to have both of these advantages?</p>