I have been trying to inject a service to a contract:
@org.jvnet.hk2.annotations.Contract
public interface CategoryDAO{
}
@org.jvnet.hk2.annotations.Service
public class HibernateCategoryDAO implements CategoryDAO
}
@org.jvnet.hk2.annotations.Service
public class MyCategoryManager implements CategoryManager {
@javax.inject.Inject
CategoryDAO categoryDAO;
}
But categoryDAO is null.
I tried even to bind it:
public class ServiceBinder implements Binder {
@Override
public void bind(DynamicConfiguration config) {
config.bind(BuilderHelper.link(HibernateCategoryDAO.class).to(CategoryDAO.class).build());
}
}
But still it stays null.
I init the MyCategoryManager
with Reflections framework like this:
Set<?> managers = Reflections.getSubTypesOf(CategoryManager.class);