| | |
| | | import org.springframework.beans.factory.annotation.Value |
| | | import org.springframework.context.annotation.Bean |
| | | import org.springframework.context.annotation.Configuration |
| | | import org.springframework.http.HttpMethod |
| | | import springfox.documentation.builders.ApiInfoBuilder |
| | | import springfox.documentation.builders.PathSelectors |
| | | import springfox.documentation.builders.RequestHandlerSelectors |
| | | import springfox.documentation.oas.annotations.EnableOpenApi |
| | | import springfox.documentation.schema.ModelReference |
| | | import springfox.documentation.service.Header |
| | | import springfox.documentation.service.Response |
| | | import springfox.documentation.spi.DocumentationType |
| | | import springfox.documentation.spring.web.plugins.Docket |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2 |
| | |
| | | * Date: 2020/8/28 |
| | | */ |
| | | @Configuration |
| | | @EnableSwagger2 |
| | | @EnableOpenApi |
| | | class Swagger2Configuration { |
| | | |
| | | companion object { |
| | |
| | | |
| | | @Bean |
| | | fun createRestApi(): Docket = |
| | | Docket(DocumentationType.SWAGGER_2) |
| | | .enable(swagger2Enable) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE)) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | Docket(DocumentationType.OAS_30) |
| | | .enable(swagger2Enable) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE)) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | |
| | | |
| | | private fun apiInfo() = |
| | | ApiInfoBuilder() |
| | | .title("飞羽智能环境服务") |
| | | .description("飞羽智能环境服务 API 接口文档") |
| | | .version(VERSION) |
| | | .build() |
| | | ApiInfoBuilder() |
| | | .title("飞羽智能环境服务") |
| | | .description("飞羽智能环境服务 API 接口文档") |
| | | .version(VERSION) |
| | | .build() |
| | | } |