title: Scala Multiple Implementations Design
body: <p>Consider the case where I have an interface that has multiple implementations, each of which is active in my application in a normal deployment. For a more concrete example, we can consider that these are implementations of a <code>Notifier</code> interface, of which there is <code>PushNotifier</code>, <code>EmailNotifier</code> and <code>SmsNotifier</code>.</p>
  
  <p>In Java, using Spring, I inject all 3 into a class, and create a <code>Map&lt;NotificationType, Notifier&gt;</code> that I can use to get the notifier for a certain type of notification.</p>
  
  <p>I'm wondering what the best pattern is to do the same in Scala. Most things I have seen suggest pattern matching:</p>
  
  <pre><code>notificationType match {
      case Push =&gt; pushNotifier.notify
      case Email =&gt; emailNotifier.notify
      // ...
  }
  </code></pre>
  
  <p>But that seems to sort of defeat the purpose of DI/IoC. However, none of the major Scala DI frameworks provide a great mechanism for having multiple implementations of the same interface injected as a list (actually, I am using Spring in Scala right now - but trying to avoid most of the crazy functionality and use it just for basic wiring)</p>
  
  <p>Is there a more Scala-esque pattern for this that I'm not grasping?</p>