当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Error with RessourceConfig jersey and Swagger

问题描述:

I have an error I am not able to fix for now with swagger. First my files :

public static HttpServer startServer() {

// create a resource config that scans for JAX-RS resources and providers

// in com.telecom package

final ResourceConfig rc = new ResourceConfig().packages("fr.test");

// Manage CORS

rc.register(new CORSResponseFilter());

rc.register(ApiListingResourceJSON.class);

rc.register(io.swagger.jaxrs.listing.ApiListingResource.class);

rc.register(io.swagger.jaxrs.listing.SwaggerSerializers.class);

BeanConfig beanConfig = new BeanConfig();

beanConfig.setVersion("1.0.2");

beanConfig.setSchemes(new String[]{"http"});

beanConfig.setHost("localhost:80");

beanConfig.setBasePath("/api/");

beanConfig.setResourcePackage("fr.test");

beanConfig.setScan(true);

// create and start a new instance of grizzly http server

// exposing the Jersey application at BASE_URI

HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);

HttpHandler httpHandler = new CLStaticHttpHandler(HttpServer.class.getClassLoader(), "/");

httpServer.getServerConfiguration().addHttpHandler(httpHandler, "/");

return httpServer;

}

分享给朋友:
您可能感兴趣的文章:
随机阅读: