|
|
1
|
+package com.sunyo.wlpt.message.bus.service.config;
|
|
|
2
|
+
|
|
|
3
|
+import org.springframework.context.annotation.Bean;
|
|
|
4
|
+import org.springframework.context.annotation.Configuration;
|
|
|
5
|
+import springfox.documentation.builders.ApiInfoBuilder;
|
|
|
6
|
+import springfox.documentation.builders.PathSelectors;
|
|
|
7
|
+import springfox.documentation.builders.RequestHandlerSelectors;
|
|
|
8
|
+import springfox.documentation.service.ApiInfo;
|
|
|
9
|
+import springfox.documentation.spi.DocumentationType;
|
|
|
10
|
+import springfox.documentation.spring.web.plugins.Docket;
|
|
|
11
|
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|
|
12
|
+
|
|
|
13
|
+/**
|
|
|
14
|
+ * @author 子诚
|
|
|
15
|
+ * Description:swagger-knife4j 的配置文件
|
|
|
16
|
+ * 时间:2020/7/10 11:48
|
|
|
17
|
+ */
|
|
|
18
|
+@Configuration
|
|
|
19
|
+@EnableSwagger2
|
|
|
20
|
+public class SwaggerConfig {
|
|
|
21
|
+ @Bean
|
|
|
22
|
+ public Docket createRestApi() {
|
|
|
23
|
+ return new Docket(DocumentationType.SWAGGER_2)
|
|
|
24
|
+ .apiInfo(apiInfo())
|
|
|
25
|
+ .select()
|
|
|
26
|
+ .apis(RequestHandlerSelectors.basePackage("com.sunyo.wlpt.message.bus.service.controller"))
|
|
|
27
|
+ .paths(PathSelectors.any())
|
|
|
28
|
+ .build();
|
|
|
29
|
+ }
|
|
|
30
|
+ /**
|
|
|
31
|
+ * 默认访问地址是:http://${host}:${port}/doc.html
|
|
|
32
|
+ */
|
|
|
33
|
+ private ApiInfo apiInfo() {
|
|
|
34
|
+ return new ApiInfoBuilder()
|
|
|
35
|
+ .title("消息平台控制中心 APIs")
|
|
|
36
|
+ .description("swagger-bootstrap-ui")
|
|
|
37
|
+ .termsOfServiceUrl("http://localhost:9030/")
|
|
|
38
|
+ .contact("523186180@qq.com")
|
|
|
39
|
+ .version("1.0.0")
|
|
|
40
|
+ .build();
|
|
|
41
|
+ }
|
|
|
42
|
+} |