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("/");
    }
  • 相关阅读:
    jquery过滤特殊字符及js字符串转为数字
    jquery.validate.js表单验证
    jquery 判断checkbox状态
    jquery.lazyload.js 图片延迟加载
    ASP.NET MVC 中使用用户控件——转
    ASP.NET MVC3关于生成纯静态后如何不再走路由直接访问静态页面--收藏没测
    jquery.validation.js 表单验证
    jquery表单验证插件 jquery.form.js-转
    .net 获取客户端Ip地址
    在IE中MVC控制器中返回JSON格式的数据时提示下载
  • 原文地址:https://www.cnblogs.com/Amos-Turing/p/10065377.html
Copyright © 2011-2022 走看看