| | |
| | | package com.nuvole.four.config; |
| | | |
| | | import com.nuvole.constants.SystemConstants; |
| | | 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.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.schema.ModelRef; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.service.Parameter; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 类描述: swagger.config |
| | | * |
| | | * @author dqh |
| | | * @date 2024-04-09 18:16 |
| | | * @version 1.0 |
| | | **/ |
| | | @EnableSwagger2 |
| | | @Configuration |
| | | public class SwaggerConfig { |
| | | |
| | | @Bean |
| | | public Docket customDocket() { |
| | | ParameterBuilder ticketPar = new ParameterBuilder(); |
| | | List<Parameter> pars = new ArrayList<Parameter>(); |
| | | ticketPar.name(SystemConstants.SHOP_WECHAT_TOKEN_HEADER).description("登录成功token标识") |
| | | .modelRef(new ModelRef("string")).parameterType("header") |
| | | .required(false).build(); |
| | | pars.add(ticketPar.build()); |
| | | |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .apis(RequestHandlerSelectors.basePackage("com.nuvole.four")) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | .globalOperationParameters(pars); |
| | | } |
| | | |
| | | |
| | | ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("四方支付") |
| | | .description("四方支付接口文档") |
| | | .version("1.0") |
| | | .build(); |
| | | } |
| | | |
| | | } |
| | | //package com.nuvole.four.config; |
| | | // |
| | | //import com.nuvole.constants.SystemConstants; |
| | | //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.PathSelectors; |
| | | //import springfox.documentation.builders.RequestHandlerSelectors; |
| | | //import springfox.documentation.schema.ModelRef; |
| | | //import springfox.documentation.service.ApiInfo; |
| | | //import springfox.documentation.service.Parameter; |
| | | //import springfox.documentation.spi.DocumentationType; |
| | | //import springfox.documentation.spring.web.plugins.Docket; |
| | | //import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | // |
| | | //import java.util.ArrayList; |
| | | //import java.util.List; |
| | | // |
| | | ///** |
| | | // * 类描述: swagger.config |
| | | // * |
| | | // * @author dqh |
| | | // * @date 2024-04-09 18:16 |
| | | // * @version 1.0 |
| | | // **/ |
| | | //@EnableSwagger2 |
| | | //@Configuration |
| | | //public class SwaggerConfig { |
| | | // |
| | | // @Bean |
| | | // public Docket customDocket() { |
| | | // ParameterBuilder ticketPar = new ParameterBuilder(); |
| | | // List<Parameter> pars = new ArrayList<Parameter>(); |
| | | // ticketPar.name(SystemConstants.SHOP_WECHAT_TOKEN_HEADER).description("登录成功token标识") |
| | | // .modelRef(new ModelRef("string")).parameterType("header") |
| | | // .required(false).build(); |
| | | // pars.add(ticketPar.build()); |
| | | // |
| | | // return new Docket(DocumentationType.SWAGGER_2) |
| | | // .apiInfo(apiInfo()) |
| | | // .select() |
| | | // .apis(RequestHandlerSelectors.basePackage("com.nuvole.four")) |
| | | // .paths(PathSelectors.any()) |
| | | // .build() |
| | | // .globalOperationParameters(pars); |
| | | // } |
| | | // |
| | | // |
| | | // ApiInfo apiInfo() { |
| | | // return new ApiInfoBuilder() |
| | | // .title("四方支付") |
| | | // .description("四方支付接口文档") |
| | | // .version("1.0") |
| | | // .build(); |
| | | // } |
| | | // |
| | | //} |