1.效果图如下:

如何在swagger中配置多个spec

 

2.已springBoot项目为例

  在SwaggerConfig中添加以下代码:

     

@Bean("质量管理")
public Docket controller1Apis() {
  return new Docket(DocumentationType.SWAGGER_2)
      .groupName("质量管理")
      .select()
      .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
      .paths(PathSelectors.regex("/quality/.*"))
      .build()
      .apiInfo(apiInfo())
      .enable(swaggerEnabled);
}

其中“"/quality/.*”就是controller中配置的url,会根据controller里面配置的url分spec

 

相关文章:

  • 2021-08-14
  • 2021-07-25
  • 2022-12-23
  • 2021-06-13
  • 2022-12-23
  • 2022-12-23
  • 2023-01-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-12
  • 2022-12-23
  • 2021-12-21
  • 2021-06-01
  • 2021-10-14
  • 2022-12-23
相关资源
相似解决方案