Squarespace / jersey2-guice

Jersey 2.0 w/ Guice

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@Qualifier / @BindingAnnotation annotated dependencies are not being injected into hk2 created services

jontejj opened this issue · comments

Usually you can use @nAmed to qualify dependencies:

  @Inject
  ColorfulResource(@Named("red") String color)
  {
    this.color = color;
  }

But JSR-330 also has support for @qualifier (http://atinject.googlecode.com/svn/trunk/javadoc/javax/inject/Qualifier.html) , guice also uses @BindingAnnotation (https://github.com/google/guice/wiki/BindingAnnotations)

  @Inject
  MyQualifierResource(@Saab Car car)
  {
    this.car = car;
  }