1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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();
//    }
}