|
|
|
@ -1,14 +1,13 @@ |
|
|
|
package com.xm; |
|
|
|
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import springfox.documentation.builders.ApiInfoBuilder; |
|
|
|
import springfox.documentation.builders.ParameterBuilder; |
|
|
|
import springfox.documentation.builders.RequestHandlerSelectors; |
|
|
|
import springfox.documentation.schema.ModelRef; |
|
|
|
import springfox.documentation.service.*; |
|
|
|
import springfox.documentation.builders.ApiInfoBuilder; |
|
|
|
import springfox.documentation.builders.RequestHandlerSelectors; |
|
|
|
import springfox.documentation.spi.DocumentationType; |
|
|
|
import springfox.documentation.spi.service.contexts.SecurityContext; |
|
|
|
import springfox.documentation.spring.web.plugins.Docket; |
|
|
|
@ -45,6 +44,9 @@ public class SwaggerConfig { |
|
|
|
@Value(value = "${server.port:}") |
|
|
|
String serverPort=""; |
|
|
|
|
|
|
|
@Value(value = "${swagger2.enable:true}") |
|
|
|
boolean enableSwagger2; |
|
|
|
|
|
|
|
@Bean |
|
|
|
public Docket customDocket() { |
|
|
|
ParameterBuilder tokenPar= new ParameterBuilder(); |
|
|
|
@ -56,7 +58,7 @@ public class SwaggerConfig { |
|
|
|
Docket docket= new Docket(DocumentationType.SWAGGER_2).select(). |
|
|
|
apis(RequestHandlerSelectors.any()) |
|
|
|
.build().globalOperationParameters(pars) |
|
|
|
.apiInfo(apiInfo()).enable(true); |
|
|
|
.apiInfo(apiInfo()).enable(enableSwagger2); |
|
|
|
|
|
|
|
/* |
|
|
|
* 下面的语句是开启对JWT的支持,当用户用Swagger调用受JWT认证保护的方法, |
|
|
|
|