fanxw 2 vuotta sitten
vanhempi
commit
ef47f64359

+ 6 - 1
src/main/java/com/chinaitop/agile/SwaggerAgileConfig.java

@@ -1,5 +1,6 @@
1 1
 package com.chinaitop.agile;
2 2
 
3
+import org.springframework.beans.factory.annotation.Value;
3 4
 import org.springframework.context.annotation.Bean;
4 5
 import org.springframework.context.annotation.Configuration;
5 6
 
@@ -15,6 +16,9 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
15 16
 @EnableSwagger2
16 17
 public class SwaggerAgileConfig {
17 18
 
19
+	@Value("${eureka.instance.hostname}")
20
+	private String eureka_ip;
21
+
18 22
 	@Bean
19 23
     public Docket createRestApi() {
20 24
         return new Docket(DocumentationType.SWAGGER_2)
@@ -25,10 +29,11 @@ public class SwaggerAgileConfig {
25 29
                 .build();
26 30
     }
27 31
     private ApiInfo apiInfo() {
32
+    	String url = "http://"+eureka_ip+":9001";
28 33
         return new ApiInfoBuilder()
29 34
                 .title("智能粮库管理平台api文档")
30 35
                 .description("出入库模块连接")
31
-                .termsOfServiceUrl("http://localhost:9026")
36
+                .termsOfServiceUrl(url.trim())
32 37
                 .version("1.0")
33 38
                 .build();
34 39
     }

+ 2 - 1
src/main/resources/bootstrap.yml

@@ -9,12 +9,13 @@ eureka:
9 9
     service-url:
10 10
       defaultZone: http://localhost:9001/eureka/
11 11
   instance:
12
+    hostname: 172.16.0.16
12 13
     #prefer-ip-address: true
13 14
     # 每隔10s发送一次心跳(默认30s)
14 15
     lease-renewal-interval-in-seconds: 10
15 16
     # 告知服务端30秒还未收到心跳的话,就将该服务移除列表(默认90s)
16 17
     lease-expiration-duration-in-seconds: 30
17
-    status-page-url: /swagger-ui.html
18
+    status-page-url: http://${eureka.instance.hostname}:9026/swagger-ui.html
18 19
 
19 20
 mybatis:
20 21
   config-location: classpath:mybatis/mybatis-config.xml