私はそれが表示さhttp://localhost:57116/swagger-ui.htmlサイトをアップロードするとSpringBootジャージー(1.5)(1.5.8)SpringでJerseyでSwaggerを使用するにはどうすればよいですか?
私の公開APIの仕事の罰金に私の呼び出しhttp://localhost:57116/rest/customer/list
で闊歩(2.6)を使用しようとしていますデフォルトのAPIがたくさんありますが、APIは表示されません。
私はこの後に試しましたConfig Swagger-ui with Jerseyしかし、それでも戻ってこないです。
これはこれはこれは私のエンドポイント
@Component
@Path("customer")
@Api(value = "Customer API")
public class CustomerImpl {
@Path("list")
@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "list")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success", response = List.class),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 403, message = "Forbidden"),
@ApiResponse(code = 404, message = "Not Found"),
@ApiResponse(code = 500, message = "Failure")})
public String[] getList()
{
return new String[]{"IBM", "Microsoft", "Victor"};
}
}
私は春RestControllerを使用して、同様の設定をしようとすると、それが動作である
@SpringBootApplication
@EnableDiscoveryClient
@EnableSwagger2
public class CustomerApplication {...}
私のアプリケーションクラスである私のJerseyConfig
@Configuration
@ApplicationPath("rest")
public class JerseyConfig extends ResourceConfig {
public JerseyConfig()
{
register(CustomerImpl.class);
configureSwagger();
}
public void configureSwagger()
{
this.register(ApiListingResource.class);
this.register(SwaggerSerializers.class);
BeanConfig beanConfig = new BeanConfig();
beanConfig.setTitle("Swagger sample app");
beanConfig.setVersion("1.0.0");
beanConfig.setSchemes(new String[]{"http"});
beanConfig.setHost("localhost:57116");
beanConfig.setBasePath("/rest");
beanConfig.setResourcePackage("com.mypackage");
beanConfig.setScan(true);
}
}
です私のパブリックAPIは表示されません。スワッガーの設定を無視しているようです
Hmm、実際の動作例でも動作しません。 –
どのように実行しようとしていますか、どのような種類のエラーが表示されていますか? –
springfoxの依存関係と@ EnableSwagger2を削除すると、何かするたびに次のダイアログボックスが表示されます。ベースURLを推測できません。これは、動的サーブレット登録を使用する場合、またはAPIがAPIゲートウェイの背後にある場合に一般的です。ベースURLは、すべてのスワッガーリソースが提供されるルートです。例えば、 apiがhttp://example.org/api/v2/api-docsにある場合、ベースURLはhttp://example.org/api/です。手動で場所を入力してください: –