Browse Source

eureka feign

wangyunpeng 2 weeks ago
parent
commit
bc9a2fa8cc

+ 4 - 0
api-module/src/main/java/com/tzld/piaoquan/api/GrowthServerApplication.java

@@ -3,6 +3,8 @@ package com.tzld.piaoquan.api;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.web.servlet.ServletComponentScan;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.ComponentScan;
 import springfox.documentation.swagger2.annotations.EnableSwagger2;
 
@@ -15,6 +17,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
 })
 @EnableSwagger2
 @ServletComponentScan("com.tzld.piaoquan.api.filter")
+@EnableDiscoveryClient
+@EnableFeignClients
 public class GrowthServerApplication {
     public static void main(String[] args) {
         SpringApplication.run(GrowthServerApplication.class, args);

+ 6 - 0
api-module/src/main/resources/application-dev.properties

@@ -19,3 +19,9 @@ apollo.meta: http://devapolloconfig-internal.piaoquantv.com
 logging.file.path=./${spring.application.name}/logs/
 
 aliyun.log.project=growth-manager-test
+
+feign.client.config.default.logger-level=NONE
+feign.client.config.default.connect-timeout=20000
+feign.client.config.default.read-timeout=20000
+
+eureka.client.serviceUrl.defaultZone=http://deveureka-internal.piaoquantv.com/eureka/

+ 6 - 0
api-module/src/main/resources/application-prod.properties

@@ -17,3 +17,9 @@ pushMessage.callback.tag=mini
 apollo.meta: http://apolloconfig-internal.piaoquantv.com
 
 aliyun.log.project=growth-manager-prod
+
+feign.client.config.default.logger-level=NONE
+feign.client.config.default.connect-timeout=20000
+feign.client.config.default.read-timeout=20000
+
+eureka.client.serviceUrl.defaultZone=http://eureka-internal.piaoquantv.com/eureka/

+ 6 - 0
api-module/src/main/resources/application-test.properties

@@ -21,3 +21,9 @@ apollo.meta: http://testapolloconfig-internal.piaoquantv.com
 logging.file.path=./${spring.application.name}/logs/
 
 aliyun.log.project=growth-manager-test
+
+feign.client.config.default.logger-level=NONE
+feign.client.config.default.connect-timeout=20000
+feign.client.config.default.read-timeout=20000
+
+eureka.client.serviceUrl.defaultZone=http://testeureka-internal.piaoquantv.com/eureka/

+ 12 - 0
pom.xml

@@ -252,6 +252,18 @@
             <artifactId>spring-boot-starter-validation</artifactId>
         </dependency>
 
+        <!-- Eureka 客户端 -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+        </dependency>
+
+        <!-- OpenFeign -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+
     </dependencies>
 
 </project>