ComponentProvider not working when use `register` strategy !!!
As the docs https://jersey.github.io/documentation/latest/user-guide.html#deployment.classpath-scanning said, i set ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE to true and regist a self defined ComponentProvider named TestComponentProvider as follows:
import org.glassfish.jersey.jackson.JacksonFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.ServerProperties;
public class ApplicationConfig extends ResourceConfig {
public ApplicationConfig() {
// ...
register(new TestComponentProvider());
property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);
}
}
import org.glassfish.jersey.internal.inject.InjectionManager;
import org.glassfish.jersey.server.spi.ComponentProvider;
import java.util.Set;
public class TestComponentProvider implements ComponentProvider {
@Override
public void initialize(InjectionManager injectionManager) {
System.out.println("-------------------->TestComponentProvider");
}
@Override
public boolean bind(Class<?> component, Set<Class<?>> providerContracts) {
return false;
}
@Override
public void done() {
}
}
but TestComponentProvider did not regist successfully, anyone knows why?
Anothor surprising thing is that even if i set ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE to true, Jersey will also read ComponentProvider from META-INF 😞
Reproduce repository is here: https://github.com/blling/jersey-spring-jetty
cc @jansupol could you take a look?
cc @tomas-langer ?
cc @pavelbucek?
Hi @jansupol , I have the same problem with guice-brige, and since its tagged as Bug I'd assume it's confirmed. As lacking of the doc, could you please hint another way to the InjectionManager for use? Thanks!