[英]swagger jersey 2.5 Rest API integration not working
I followed the step to add Swagger to my already built Jersey REST API project in TOMCAT I follow the steps https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-2.X-Project-Setup-1.5#configure-and-initialize-swagger 我按照将Swagger添加到我已经在TOMCAT中已经建立的Jersey REST API项目中的步骤执行了我的步骤https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-2.X-Project -Setup-1.5#configure-and-initialize-swagger
Step 1: Added following 步骤1:添加了以下内容
swagger-annotations_2.10-1.3.0
swagger-core_2.10-1.3.10
swagger-jaxrs_2.10-1.3.10
swagger-jersey2-jaxrs_2.10-1.3.10
Step 2: Added Swagger core provider in Application sub class 步骤2:在Application子类中添加了Swagger核心提供程序
resources.add(com.wordnik.swagger.jersey.listing.ApiListingResource.class);
resources.add(com.wordnik.swagger.jersey.listing.JerseyApiDeclarationProvider.class);
resources.add(com.wordnik.swagger.jersey.listing.ApiListingResourceJSON.class);
resources.add(com.wordnik.swagger.jersey.listing.JerseyResourceListingProvider.class);
Step 3. Used Application class constructor to setup Swagger: 步骤3.使用Application类构造函数设置Swagger:
public ApplicationConfig() {
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0.0");
beanConfig.setBasePath("localhost:8080/api");
beanConfig.setResourcePackage(RESOURCE_PACKAGE);
beanConfig.setScan(true);
}
However, when I navigate to: 但是,当我导航到:
http://localhost:8080/Test/api/partner/v1/swagger.json http:// localhost:8080 / Test / api / partner / v1 / swagger.json
I see: 我懂了:
HTTP Status 404 - page not found.
HTTP状态404-找不到页面。
I see a couple things. 我看到了几件事。 First, from that guide, the dependencies should be:
首先,从该指南中,依赖关系应为:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
<version>1.5.0</version>
</dependency>
Your post looks like they are not 1.5.0 (actually you can use 1.5.3 as of last week). 您的帖子看起来好像不是1.5.0(实际上您可以在上周使用1.5.3)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.