org.glassfish.hk2.api.UnsatisfiedDependencyException: Es war kein Objekt zur Verfügung für die Injektion am Injectee

Ich bin neu nach Jersey 2. Bisher arbeitete ich mit Jersey 1.x und im Frühling nutzen möchte HK2 Umsetzung.

Nach dem Lesen der tutorial schrieb ich Folgendes:

@ManagedBean
@Path("products")
@Produces({ MediaType.APPLICATION_JSON })
public class ProductResource {

    @Inject
    ProductManager productManager;

    @GET
    public GenericResponseData<List<Product>> getProducts(@QueryParam("condition") Condition condition, @QueryParam("keywords") String keywords) {
        GenericResponseData<List<Product>> res = new GenericResponseData<List<Product>>();
        res.setObject(productManager.getProducts(condition, keywords));
        return res;
    }

}
@Contract
public interface ProductManager {
    public List<Product> getProducts(Condition condition, String keywords);
}

@Service
public class MyProductManager implements ProductManager {
    @Override
    public List<Product> getProducts(Condition condition, String keywords) {
            return null;
        }
}

Jedoch bekomme ich die folgende exception:

org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee

Was ist falsch?

InformationsquelleAutor Dejell | 2014-01-21

Schreibe einen Kommentar