Skip to content
This repository has been archived by the owner on May 28, 2018. It is now read-only.

ComponentProvider not working when use register strategy !!! #3770

Open
blling opened this issue Feb 8, 2018 · 6 comments
Open

ComponentProvider not working when use register strategy !!! #3770

blling opened this issue Feb 8, 2018 · 6 comments

Comments

@blling
Copy link

blling commented Feb 8, 2018

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?

@blling
Copy link
Author

blling commented Feb 8, 2018

Anothor surprising thing is that even if i set ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE to true, Jersey will also read ComponentProvider from META-INF 😞

@blling
Copy link
Author

blling commented Feb 8, 2018

Reproduce repository is here: https://github.com/blling/jersey-spring-jetty

@blling
Copy link
Author

blling commented Feb 8, 2018

cc @jansupol could you take a look?

@blling
Copy link
Author

blling commented Feb 9, 2018

cc @tomas-langer ?

@blling
Copy link
Author

blling commented Feb 10, 2018

cc @pavelbucek?

@zhaob
Copy link

zhaob commented Mar 15, 2018

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants