Closed alswl closed 5 years ago
测试下来 8341 端口里面的 javax.ws.rs 接口无法通过包扫描暴露到 Swagger UI 上,只能将 8080 端口里面的 Controller API 暴露出来。
有人遇到这个问题么?是否有什么额外配置。我目前 SwaggerConfig 配置如下:
@Configuration @EnableSwagger2 public class SwaggerConfig extends WebMvcConfigurationSupport { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.basePackage("com.test.module.endpoint.facade")) .paths(PathSelectors.any()) .build(); } @Override protected void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("swagger-ui.html") .addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("/webjars/**") .addResourceLocations("classpath:/META-INF/resources/webjars/"); } }
https://github.com/alipay/sofa-rpc/issues/377
搞了一会还挺麻烦,springfox / swagger 对 ws.rs 的支持就假设了前提:使用 Jersey 实现 javax.ws.rs。 SOFA Boot 是 sofa-rest-api 提供了实现(不确定)。
关于和 swagger 集成的方案参考 https://www.sofastack.tech/sofa-rpc/docs/RESTful-Swagger 文档。
测试下来 8341 端口里面的 javax.ws.rs 接口无法通过包扫描暴露到 Swagger UI 上,只能将 8080 端口里面的 Controller API 暴露出来。
有人遇到这个问题么?是否有什么额外配置。我目前 SwaggerConfig 配置如下: