Originally I did include my classes manually by doing this
@ApplicationPath("/")
public class RestApplication extends Application {
@Override
public Set<Class<?>> getClasses() {
final Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(RestServlet.class);
classes.add(RestService.class);
return classes;
}
}
Then I found out in order to be able to inject RestService in RestServlet I need to use a ResourceConfig binder instead.
public class RestApplication extends ResourceConfig {
public RestApplication() {
register(new RestBinder());
packages(true, "");
}
}
But I can't figure out how to use ResourceConfig without defining a package and bind it manually for each injection class?
PS I also don't understand how to make sure all package scanning is disabled?