| New file | 
|  |  |  | 
|---|
|  |  |  | package com.dy.common.apiDoc; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import io.swagger.v3.oas.models.OpenAPI; | 
|---|
|  |  |  | import io.swagger.v3.oas.models.info.Info; | 
|---|
|  |  |  | import io.swagger.v3.oas.models.info.License; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Value; | 
|---|
|  |  |  | import org.springframework.context.annotation.Bean; | 
|---|
|  |  |  | import org.springframework.context.annotation.Configuration; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Configuration | 
|---|
|  |  |  | public class SpringApiConfig { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${springdoc.web.title}") | 
|---|
|  |  |  | public String title ; | 
|---|
|  |  |  | @Value("${springdoc.web.description}") | 
|---|
|  |  |  | public String description ; | 
|---|
|  |  |  | @Value("${springdoc.web.version}") | 
|---|
|  |  |  | public String version ; | 
|---|
|  |  |  | @Value("${springdoc.web.license-name}") | 
|---|
|  |  |  | public String licenseName ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 设置spring doc api一些全局内容 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Bean | 
|---|
|  |  |  | public OpenAPI springDocOpenAPI() { | 
|---|
|  |  |  | OpenAPI openAPI = new OpenAPI() | 
|---|
|  |  |  | .info(new Info().title(title) | 
|---|
|  |  |  | .description(description) | 
|---|
|  |  |  | .version(version) | 
|---|
|  |  |  | .license(new License().name(licenseName) | 
|---|
|  |  |  | //.url("http://www.gsdyjsgs.com/") | 
|---|
|  |  |  | )) | 
|---|
|  |  |  | //.externalDocs(new ExternalDocumentation() | 
|---|
|  |  |  | //                .description(externalDocsDescription) | 
|---|
|  |  |  | //.url("http://www.gsdyjsgs.com/") | 
|---|
|  |  |  | //) | 
|---|
|  |  |  | ; | 
|---|
|  |  |  | return openAPI ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //因为子模块只有一个上下文,所以不用再分组了 | 
|---|
|  |  |  | //如果一个子模块有多个一级上下文或多个二级上下文,可以分组 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    /** | 
|---|
|  |  |  | //     * 基础信息 分组 | 
|---|
|  |  |  | //     * @return 分组接口 | 
|---|
|  |  |  | //     */ | 
|---|
|  |  |  | //    @Bean | 
|---|
|  |  |  | //    public GroupedOpenApi baseApi() { | 
|---|
|  |  |  | //        return GroupedOpenApi.builder() | 
|---|
|  |  |  | //                .group(groupNameBase) | 
|---|
|  |  |  | //                .pathsToMatch("/base/**") | 
|---|
|  |  |  | //                .build(); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    /** | 
|---|
|  |  |  | //     * 远程操作 分组 | 
|---|
|  |  |  | //     * @return 分组接口 | 
|---|
|  |  |  | //     */ | 
|---|
|  |  |  | //    @Bean | 
|---|
|  |  |  | //    public GroupedOpenApi remoteApi() { | 
|---|
|  |  |  | //        return GroupedOpenApi.builder() | 
|---|
|  |  |  | //                .group(groupNameRemote) | 
|---|
|  |  |  | //                .pathsToMatch("/remote/**") | 
|---|
|  |  |  | //                .build(); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | } | 
|---|