Skip to content

Instantly share code, notes, and snippets.

@rethab
rethab / named-instance.scala
Created September 12, 2016 09:49
get instance by named annotation from guice injector with the play framework
import play.api.inject.{QualifierInstance, BindingKey}
import com.google.inject.name.Names
val injector = ???
injector.instanceOf(BindingKey(classOf[MyType], Some(QualifierInstance(Names.named("my-thing")))))