src/main/kotlin/cn/flightfeather/supervision/config/Swagger2Configuration.kt
@@ -1,5 +1,6 @@
package cn.flightfeather.supervision.config
import io.swagger.annotations.Api
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@@ -13,12 +14,13 @@
/**
 * @author riku
 * Date: 2020/8/28
 * 访问地址:http://localhost:8080/swagger-ui/index.html
 */
@Configuration
@EnableSwagger2
class Swagger2Configuration(
    @Value("\${springfox.documentation.swagger.v2.enabled}")
    var swagger2Enable: Boolean
    var swagger2Enable: Boolean,
) {
    companion object {
@@ -29,19 +31,20 @@
    @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.SWAGGER_2)
            .enable(swagger2Enable)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE))
            .apis(RequestHandlerSelectors.withClassAnnotation(Api::class.java))
            .paths(PathSelectors.any())
            .build()
    private fun apiInfo() =
            ApiInfoBuilder()
                    .title("第三方监管服务")
                    .description("第三方监管服务 API 接口文档")
                    .version(VERSION)
                    .build()
        ApiInfoBuilder()
            .title("第三方监管服务")
            .description("第三方监管服务 API 接口文档")
            .version(VERSION)
            .build()
}