Swagger:端点未初始化

时间:2018-02-26 07:18:19

标签: java jersey swagger

为javax端点配置swagger时,我收到以下警告。你能解释我错过的东西吗?

我已经附加了用于初始化swagger并附加到服务器的代码。

记录日志:

Attempting to start Grizzly on http://0.0.0.0:52204
Feb 26, 2018 3:09:55 PM org.glassfish.jersey.internal.inject.Providers checkProviderRuntime
WARNING: A provider ipos.hashgraph.utils.Swagger registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constraint configuration problems the provider ipos.hashgraph.utils.Swagger will be ignored. 
Feb 26, 2018 3:09:56 PM org.glassfish.grizzly.http.server.NetworkListener start
INFO: Started listener bound to [0.0.0.0:52204]

使用的代码:

public class Swagger extends ResourceConfig {

        public Swagger(){
            register(DocumentApi.class);
            register(JacksonFeature.class);

            register(ApiListingResource.class);
            property(MessageProperties.XML_FORMAT_OUTPUT, true);
            property(ServerProperties.TRACING, "ALL");
        }


        public void initializeSwaggerConfiguration() {

            final ReflectiveJaxrsScanner scanner = new ReflectiveJaxrsScanner();
            scanner.setResourcePackage("ipos.hashgraph.rest");
            ScannerFactory.setScanner(scanner);
            ClassReaders.setReader(new DefaultJaxrsApiReader());
            final SwaggerConfig config = ConfigFactory.config();
           // config.setApiVersion("1.0");
            config.setBasePath("http://localhost:8080/swagger/");
        }
}

服务器初始化

public static void initREST(int port, String[] packages) {
        URI baseUri = UriBuilder.fromUri("http://0.0.0.0").port(port).build();
        ResourceConfig config = new ResourceConfig()
                .register(new CORSFilter())
                .register(new Swagger())
                .register(JacksonFeature.class);

        for (String pkg : packages) {
            config.packages(pkg);
        }

        System.out.println("Attempting to start Grizzly on " + baseUri);
        GrizzlyHttpServerFactory.createHttpServer(baseUri, config);

        try {
            platform.createTransaction(
                    new ExoMessage(
                            new 
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    }

0 个答案:

没有答案