| | |
| | | /** |
| | | * 创建API |
| | | */ |
| | | @Bean |
| | | @Bean("baseApi") |
| | | public Docket createRestApi() |
| | | { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | // 是否启用Swagger |
| | | .enable(true) |
| | | //分组名称 |
| | | .groupName("baseApi") |
| | | // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) |
| | | .apiInfo(apiInfo()) |
| | | // 设置哪些接口暴露给Swagger展示 |
| | |
| | | .securityContexts(securityContexts()) |
| | | .pathMapping("/"); |
| | | } |
| | | |
| | | /** |
| | | * 创建API-VideoCall |
| | | */ |
| | | @Bean("VideoCallApi") |
| | | public Docket createRestApiVideoCall() |
| | | { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | // 是否启用Swagger |
| | | .enable(true) |
| | | //分组名称 |
| | | .groupName("VideoCallApi") |
| | | // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) |
| | | .apiInfo(apiInfo()) |
| | | // 设置哪些接口暴露给Swagger展示 |
| | | .select() |
| | | // 扫描所有有注解的api,用这种方式更灵活 |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
| | | // 扫描指定包中的swagger注解 |
| | | .apis(RequestHandlerSelectors.basePackage("com.ruoyi.call.controller")) |
| | | // 扫描所有 .apis(RequestHandlerSelectors.any()) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | /* 设置安全模式,swagger可以设置访问token */ |
| | | .securitySchemes(securitySchemes()) |
| | | .securityContexts(securityContexts()) |
| | | .pathMapping("/"); |
| | | } |
| | | /** |
| | | * 安全模式,这里指定token通过Authorization头请求头传递 |
| | | */ |