When I have a very basic Application, Jersey auto discovers all the REST resources in the project and I don't have to manually register them:
import javax.ws.rs.ApplicationPath;
@ApplicationPath("/rest")
public class Application extends javax.ws.rs.core.Application {
}
But when I switch to using the Jersey specific ResourceConfig, auto discovery doesn't seem to work. I have to either #registerClasses() or add the package as shown below:
@ApplicationPath("rest")
public class ResourceConfig extends org.glassfish.jersey.server.ResourceConfig {
public ResourceConfig() {
super();
register(RolesAllowedDynamicFeature.class);
super.packages(true, "org.example");
}
}
Is there a way to get ResourceConfig to auto discover the REST resources like Application without having to register the classes individually or having to add the application's package?