zoukankan      html  css  js  c++  java
  • swagger多个分组代码展示

        /**
    * api信息
    *
    * @param name 标题
    * @param description 描述
    * @param version 版本
    * @return
    */
    private ApiInfo apiInfo(String name, String description, String version) {
    return new ApiInfoBuilder().title(name).description(description).version(version).build();
    }


    //定义不同的Docket 进行分组展示api 可以使用包来区分,也可以取使用路由来区分

    //这是按包来分组
    // @Bean
    // public Docket api() {
    // return new Docket(DocumentationType.SWAGGER_2)
    // .apiInfo(apiInfo())
    // .select()
    // .apis(RequestHandlerSelectors.basePackage("com.meike.station"))
    // .paths(PathSelectors.any())
    // .build()
    // .groupName("api组");
    // }

    /**
    * 按照路由来分组
    *
    * @return
    */

    @Bean
    public Docket web_api_admin() {
    return new Docket(DocumentationType.SWAGGER_2)
    .apiInfo(apiInfo("admin-api", "系统管理员", "1.0"))
    .select()
    .apis(RequestHandlerSelectors.any())
    .paths(PathSelectors.ant("/api/admin/**"))
    .build()
    .groupName("系统管理员:web-admin-接口文档V1.0")
    .pathMapping("/");
    }

    @Bean
    public Docket web_api_bm() {
    return new Docket(DocumentationType.SWAGGER_2)
    .apiInfo(apiInfo("bm-api", "商家管理员", "1.0"))
    .select()
    .apis(RequestHandlerSelectors.any())
    .paths(PathSelectors.ant("/api/business/manager/**"))
    .build()
    .groupName("商家管理员:web-bm-接口文档V1.0")
    .pathMapping("/");
    }

    @Bean
    public Docket web_api_bo() {
    return new Docket(DocumentationType.SWAGGER_2)
    .apiInfo(apiInfo("bo-api", "商家运营", "1.0"))
    .select()
    .apis(RequestHandlerSelectors.any())
    .paths(PathSelectors.ant("/api/business/operation/**"))
    .build()
    .groupName("商家运营:web-bo-接口文档V1.0")
    .pathMapping("/");
    }

    @Bean
    public Docket web_api_sm() {
    return new Docket(DocumentationType.SWAGGER_2)
    .apiInfo(apiInfo("sm-api", "站管理员", "1.0"))
    .select()
    .apis(RequestHandlerSelectors.any())
    .paths(PathSelectors.ant("/api/station/manager/**"))
    .build()
    .groupName("站管理员:web-sm-接口文档V1.0")
    .pathMapping("/");
    }

    @Bean
    public Docket web_api_so() {
    return new Docket(DocumentationType.SWAGGER_2)
    .apiInfo(apiInfo("so-api", "站运营", "1.0"))
    .select()
    .apis(RequestHandlerSelectors.any())
    .paths(PathSelectors.ant("/api/station/operation/**"))
    .build()
    .groupName("站运营:web-so-接口文档V1.0")
    .pathMapping("/");
    }

    @Bean
    public Docket xcx_api() {
    return new Docket(DocumentationType.SWAGGER_2)
    .apiInfo(apiInfo("xcx-api", "小程序", "1.0"))
    .select()
    .apis(RequestHandlerSelectors.any())
    .paths(PathSelectors.ant("/xcx/**"))
    .build()
    .groupName("小程序:xcx-接口文档V1.0")
    .pathMapping("/");
    }
  • 相关阅读:
    angularjs自定义指令complie和link属性
    港航环境变化引起的错误解决方法
    myBatis + SpringMVC上传、下载文件
    mybatis动态sql中的trim标签的使用
    MyBatis一对多和多对一
    常用的MIME类型
    SpringMVC 文件上传配置,多文件上传,使用的MultipartFile
    web自动化测试(7)--js操作
    web自动化测试(6)--下拉列表操作
    web自动化测试(5)--鼠标、键盘操作
  • 原文地址:https://www.cnblogs.com/Amos-Turing/p/10065377.html
Copyright © 2011-2022 走看看