赞
踩
背景:基于springcloud(四)基础进行
1. 在spring-cloud-ribbon工程中 添加依赖
- <dependency>
- <groupId>org.springframework.cloud</groupId>
- <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
- </dependency>
2. 引导类RibbonApplication中添加注解@EnableHystrix,修改后的内容如下
- package com.zsx;
-
- import org.springframework.boot.SpringApplication;
- import org.springframework.boot.autoconfigure.SpringBootApplication;
- import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
- import org.springframework.cloud.netflix.hystrix.EnableHystrix;
-
- @SpringBootApplication
- @EnableDiscoveryClient
- @EnableHystrix
- public class RibbonApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(RibbonApplication.class, args);
- }
- }
3. RibbonTestService类中方法添加注解@HystrixCommand及对应方法
- package com.zsx.service;
-
- import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.web.client.RestTemplate;
-
- @Service
- public class RibbonTestService {
-
- @Autowired
- private RestTemplate restTemplate;
-
- @HystrixCommand(fallbackMethod = "getError")
- public String get(String message) {
- return restTemplate.getForObject("http://SPRING-CLOUD-EUREKA-CLIENT/api/v1/test/" + message, String.class);
- }
-
- public String getError(String message) {
- return "Failed to get message";
- }
- }
4. 启动服务注册中心与ribbon消费者
5. 查看服务注册中心
6. 查看消费者http://localhost:8084/ribbon/hello
到此ribbon熔断器配置完成
1. 在spring-cloud-feign工程的application.yml配置文件中添加feign熔断器配置
- feign:
- hystrix:
- enabled: true
修改后的内容如下
- server:
- port: 8085
- spring:
- application:
- name: spring-cloud-feign
- feign:
- hystrix:
- enabled: true
- eureka:
- client:
- serviceUrl:
- defaultZone: http://localhost:8081/eureka/
2. 在FeignTestService接口上添加fallback回调
- package com.zsx.service;
-
- import com.zsx.hystrix.FeignTestHystrix;
- import org.springframework.cloud.openfeign.FeignClient;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PathVariable;
-
- @FeignClient(value = "spring-cloud-eureka-client", fallback = FeignTestHystrix.class)
- public interface FeignTestService {
-
- @GetMapping(value = "/api/v1/test/{message}")
- String get(@PathVariable("message") String message);
- }
3. 将熔断器添加到容器
- package com.zsx.hystrix;
-
- import com.zsx.service.FeignTestService;
- import org.springframework.stereotype.Component;
-
- @Component
- public class FeignTestHystrix implements FeignTestService {
-
- @Override
- public String get(String message) {
- return "Failed to get message";
- }
- }
4. 启动注册中心、Feign消费者
- C:\software\jdk-11.0.3\bin\java.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:C:\software\JetBrains\IntelliJ IDEA 2019.1.3\lib\idea_rt.jar=6883:C:\software\JetBrains\IntelliJ IDEA 2019.1.3\bin" -Dfile.encoding=UTF-8 -classpath F:\IdeaProjects\spring-cloud\spring-cloud-feign\target\classes;D:\repository\org\springframework\cloud\spring-cloud-starter-openfeign\2.1.2.RELEASE\spring-cloud-starter-openfeign-2.1.2.RELEASE.jar;D:\repository\org\springframework\cloud\spring-cloud-starter\2.1.2.RELEASE\spring-cloud-starter-2.1.2.RELEASE.jar;D:\repository\org\springframework\cloud\spring-cloud-context\2.1.2.RELEASE\spring-cloud-context-2.1.2.RELEASE.jar;D:\repository\org\springframework\security\spring-security-rsa\1.0.7.RELEASE\spring-security-rsa-1.0.7.RELEASE.jar;D:\repository\org\bouncycastle\bcpkix-jdk15on\1.60\bcpkix-jdk15on-1.60.jar;D:\repository\org\bouncycastle\bcprov-jdk15on\1.60\bcprov-jdk15on-1.60.jar;D:\repository\org\springframework\cloud\spring-cloud-openfeign-core\2.1.2.RELEASE\spring-cloud-openfeign-core-2.1.2.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-autoconfigure\2.1.6.RELEASE\spring-boot-autoconfigure-2.1.6.RELEASE.jar;D:\repository\org\springframework\cloud\spring-cloud-netflix-ribbon\2.1.2.RELEASE\spring-cloud-netflix-ribbon-2.1.2.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-aop\2.1.6.RELEASE\spring-boot-starter-aop-2.1.6.RELEASE.jar;D:\repository\org\aspectj\aspectjweaver\1.9.4\aspectjweaver-1.9.4.jar;D:\repository\io\github\openfeign\form\feign-form-spring\3.8.0\feign-form-spring-3.8.0.jar;D:\repository\io\github\openfeign\form\feign-form\3.8.0\feign-form-3.8.0.jar;D:\repository\commons-fileupload\commons-fileupload\1.4\commons-fileupload-1.4.jar;D:\repository\commons-io\commons-io\2.2\commons-io-2.2.jar;D:\repository\org\springframework\spring-web\5.1.8.RELEASE\spring-web-5.1.8.RELEASE.jar;D:\repository\org\springframework\spring-beans\5.1.8.RELEASE\spring-beans-5.1.8.RELEASE.jar;D:\repository\org\springframework\cloud\spring-cloud-commons\2.1.2.RELEASE\spring-cloud-commons-2.1.2.RELEASE.jar;D:\repository\org\springframework\security\spring-security-crypto\5.1.5.RELEASE\spring-security-crypto-5.1.5.RELEASE.jar;D:\repository\io\github\openfeign\feign-core\10.2.3\feign-core-10.2.3.jar;D:\repository\io\github\openfeign\feign-slf4j\10.2.3\feign-slf4j-10.2.3.jar;D:\repository\org\slf4j\slf4j-api\1.7.26\slf4j-api-1.7.26.jar;D:\repository\io\github\openfeign\feign-hystrix\10.2.3\feign-hystrix-10.2.3.jar;D:\repository\com\netflix\archaius\archaius-core\0.7.6\archaius-core-0.7.6.jar;D:\repository\com\google\code\findbugs\jsr305\3.0.1\jsr305-3.0.1.jar;D:\repository\com\google\guava\guava\16.0\guava-16.0.jar;D:\repository\com\netflix\hystrix\hystrix-core\1.5.18\hystrix-core-1.5.18.jar;D:\repository\org\hdrhistogram\HdrHistogram\2.1.9\HdrHistogram-2.1.9.jar;D:\repository\org\springframework\cloud\spring-cloud-starter-netflix-eureka-client\2.1.2.RELEASE\spring-cloud-starter-netflix-eureka-client-2.1.2.RELEASE.jar;D:\repository\org\springframework\cloud\spring-cloud-netflix-hystrix\2.1.2.RELEASE\spring-cloud-netflix-hystrix-2.1.2.RELEASE.jar;D:\repository\org\springframework\cloud\spring-cloud-netflix-eureka-client\2.1.2.RELEASE\spring-cloud-netflix-eureka-client-2.1.2.RELEASE.jar;D:\repository\com\netflix\eureka\eureka-client\1.9.12\eureka-client-1.9.12.jar;D:\repository\org\codehaus\jettison\jettison\1.3.7\jettison-1.3.7.jar;D:\repository\stax\stax-api\1.0.1\stax-api-1.0.1.jar;D:\repository\com\netflix\netflix-commons\netflix-eventbus\0.3.0\netflix-eventbus-0.3.0.jar;D:\repository\com\netflix\netflix-commons\netflix-infix\0.3.0\netflix-infix-0.3.0.jar;D:\repository\commons-jxpath\commons-jxpath\1.3\commons-jxpath-1.3.jar;D:\repository\joda-time\joda-time\2.10.2\joda-time-2.10.2.jar;D:\repository\org\antlr\antlr-runtime\3.4\antlr-runtime-3.4.jar;D:\repository\org\antlr\stringtemplate\3.2.1\stringtemplate-3.2.1.jar;D:\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;D:\repository\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar;D:\repository\org\apache\commons\commons-math\2.2\commons-math-2.2.jar;D:\repository\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;D:\repository\com\netflix\servo\servo-core\0.12.21\servo-core-0.12.21.jar;D:\repository\com\sun\jersey\jersey-core\1.19.1\jersey-core-1.19.1.jar;D:\repository\com\sun\jersey\jersey-client\1.19.1\jersey-client-1.19.1.jar;D:\repository\com\sun\jersey\contribs\jersey-apache-client4\1.19.1\jersey-apache-client4-1.19.1.jar;D:\repository\org\apache\httpcomponents\httpclient\4.5.9\httpclient-4.5.9.jar;D:\repository\org\apache\httpcomponents\httpcore\4.4.11\httpcore-4.4.11.jar;D:\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;D:\repository\com\google\inject\guice\4.1.0\guice-4.1.0.jar;D:\repository\javax\inject\javax.inject\1\javax.inject-1.jar;D:\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\repository\com\github\vlsi\compactmap\compactmap\1.2.1\compactmap-1.2.1.jar;D:\repository\com\github\andrewoma\dexx\dexx-collections\0.2\dexx-collections-0.2.jar;D:\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;D:\repository\com\fasterxml\jackson\core\jackson-core\2.9.9\jackson-core-2.9.9.jar;D:\repository\com\netflix\eureka\eureka-core\1.9.12\eureka-core-1.9.12.jar;D:\repository\com\fasterxml\woodstox\woodstox-core\5.0.3\woodstox-core-5.0.3.jar;D:\repository\org\codehaus\woodstox\stax2-api\3.1.4\stax2-api-3.1.4.jar;D:\repository\org\springframework\cloud\spring-cloud-starter-netflix-archaius\2.1.2.RELEASE\spring-cloud-starter-netflix-archaius-2.1.2.RELEASE.jar;D:\repository\org\springframework\cloud\spring-cloud-netflix-archaius\2.1.2.RELEASE\spring-cloud-netflix-archaius-2.1.2.RELEASE.jar;D:\repository\commons-configuration\commons-configuration\1.8\commons-configuration-1.8.jar;D:\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;D:\repository\org\springframework\cloud\spring-cloud-starter-netflix-ribbon\2.1.2.RELEASE\spring-cloud-starter-netflix-ribbon-2.1.2.RELEASE.jar;D:\repository\com\netflix\ribbon\ribbon\2.3.0\ribbon-2.3.0.jar;D:\repository\com\netflix\ribbon\ribbon-transport\2.3.0\ribbon-transport-2.3.0.jar;D:\repository\io\reactivex\rxnetty-contexts\0.4.9\rxnetty-contexts-0.4.9.jar;D:\repository\io\reactivex\rxnetty-servo\0.4.9\rxnetty-servo-0.4.9.jar;D:\repository\io\reactivex\rxnetty\0.4.9\rxnetty-0.4.9.jar;D:\repository\com\netflix\ribbon\ribbon-core\2.3.0\ribbon-core-2.3.0.jar;D:\repository\com\netflix\ribbon\ribbon-httpclient\2.3.0\ribbon-httpclient-2.3.0.jar;D:\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\repository\com\netflix\netflix-commons\netflix-commons-util\0.3.0\netflix-commons-util-0.3.0.jar;D:\repository\com\netflix\ribbon\ribbon-loadbalancer\2.3.0\ribbon-loadbalancer-2.3.0.jar;D:\repository\com\netflix\netflix-commons\netflix-statistics\0.1.1\netflix-statistics-0.1.1.jar;D:\repository\io\reactivex\rxjava\1.3.8\rxjava-1.3.8.jar;D:\repository\com\netflix\ribbon\ribbon-eureka\2.3.0\ribbon-eureka-2.3.0.jar;D:\repository\com\thoughtworks\xstream\xstream\1.4.10\xstream-1.4.10.jar;D:\repository\xmlpull\xmlpull\1.1.3.1\xmlpull-1.1.3.1.jar;D:\repository\xpp3\xpp3_min\1.1.4c\xpp3_min-1.1.4c.jar;D:\repository\org\springframework\cloud\spring-cloud-starter-config\2.1.3.RELEASE\spring-cloud-starter-config-2.1.3.RELEASE.jar;D:\repository\org\springframework\cloud\spring-cloud-config-client\2.1.3.RELEASE\spring-cloud-config-client-2.1.3.RELEASE.jar;D:\repository\com\fasterxml\jackson\core\jackson-databind\2.9.9\jackson-databind-2.9.9.jar;D:\repository\org\springframework\boot\spring-boot-starter-web\2.1.6.RELEASE\spring-boot-starter-web-2.1.6.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter\2.1.6.RELEASE\spring-boot-starter-2.1.6.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot\2.1.6.RELEASE\spring-boot-2.1.6.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-logging\2.1.6.RELEASE\spring-boot-starter-logging-2.1.6.RELEASE.jar;D:\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\repository\org\apache\logging\log4j\log4j-to-slf4j\2.11.2\log4j-to-slf4j-2.11.2.jar;D:\repository\org\apache\logging\log4j\log4j-api\2.11.2\log4j-api-2.11.2.jar;D:\repository\org\slf4j\jul-to-slf4j\1.7.26\jul-to-slf4j-1.7.26.jar;D:\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;D:\repository\org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar;D:\repository\org\springframework\boot\spring-boot-starter-json\2.1.6.RELEASE\spring-boot-starter-json-2.1.6.RELEASE.jar;D:\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.9\jackson-datatype-jdk8-2.9.9.jar;D:\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.9\jackson-datatype-jsr310-2.9.9.jar;D:\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.9\jackson-module-parameter-names-2.9.9.jar;D:\repository\org\springframework\boot\spring-boot-starter-tomcat\2.1.6.RELEASE\spring-boot-starter-tomcat-2.1.6.RELEASE.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.21\tomcat-embed-core-9.0.21.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.21\tomcat-embed-el-9.0.21.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.21\tomcat-embed-websocket-9.0.21.jar;D:\repository\org\hibernate\validator\hibernate-validator\6.0.17.Final\hibernate-validator-6.0.17.Final.jar;D:\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;D:\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;D:\repository\com\fasterxml\classmate\1.4.0\classmate-1.4.0.jar;D:\repository\org\springframework\spring-webmvc\5.1.8.RELEASE\spring-webmvc-5.1.8.RELEASE.jar;D:\repository\org\springframework\spring-aop\5.1.8.RELEASE\spring-aop-5.1.8.RELEASE.jar;D:\repository\org\springframework\spring-context\5.1.8.RELEASE\spring-context-5.1.8.RELEASE.jar;D:\repository\org\springframework\spring-expression\5.1.8.RELEASE\spring-expression-5.1.8.RELEASE.jar;D:\repository\org\springframework\spring-core\5.1.8.RELEASE\spring-core-5.1.8.RELEASE.jar;D:\repository\org\springframework\spring-jcl\5.1.8.RELEASE\spring-jcl-5.1.8.RELEASE.jar;D:\repository\org\glassfish\jaxb\jaxb-core\2.3.0.1\jaxb-core-2.3.0.1.jar;D:\repository\javax\xml\bind\jaxb-api\2.3.1\jaxb-api-2.3.1.jar;D:\repository\javax\activation\javax.activation-api\1.2.0\javax.activation-api-1.2.0.jar;D:\repository\org\glassfish\jaxb\txw2\2.3.1\txw2-2.3.1.jar;D:\repository\com\sun\istack\istack-commons-runtime\3.0.5\istack-commons-runtime-3.0.5.jar;D:\repository\com\sun\xml\bind\jaxb-impl\2.3.2\jaxb-impl-2.3.2.jar com.zsx.FeignApplication
- 2019-07-30 12:13:20.684 INFO 9188 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$d69195ff] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
-
- . ____ _ __ _ _
- /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
- ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
- \\/ ___)| |_)| | | | | || (_| | ) ) ) )
- ' |____| .__|_| |_|_| |_\__, | / / / /
- =========|_|==============|___/=/_/_/_/
- :: Spring Boot :: (v2.1.6.RELEASE)
- 2019-07-30 12:13:20.866 INFO 9188 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
- 2019-07-30 12:13:21.934 INFO 9188 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Connect Timeout Exception on Url - http://localhost:8888. Will be trying the next url if available
- 2019-07-30 12:13:21.935 WARN 9188 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/spring-cloud-feign/default": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
- 2019-07-30 12:13:21.939 INFO 9188 --- [ main] com.zsx.FeignApplication : No active profile set, falling back to default profiles: default
- 2019-07-30 12:13:22.242 INFO 9188 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=a8608b78-e09e-3a19-a2af-c35025941e47
- 2019-07-30 12:13:22.252 INFO 9188 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.zsx.service.FeignTestService' of type [org.springframework.cloud.openfeign.FeignClientFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
- 2019-07-30 12:13:22.281 INFO 9188 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$d69195ff] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
- 2019-07-30 12:13:22.407 INFO 9188 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8085 (http)
- 2019-07-30 12:13:22.421 INFO 9188 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
- 2019-07-30 12:13:22.421 INFO 9188 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.21]
- 2019-07-30 12:13:22.503 INFO 9188 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
- 2019-07-30 12:13:22.503 INFO 9188 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 538 ms
- 2019-07-30 12:13:22.632 WARN 9188 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
- 2019-07-30 12:13:22.632 INFO 9188 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
- 2019-07-30 12:13:22.633 WARN 9188 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
- 2019-07-30 12:13:22.633 INFO 9188 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
- 2019-07-30 12:13:22.697 INFO 9188 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
- 2019-07-30 12:13:22.944 INFO 9188 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
- 2019-07-30 12:13:22.959 INFO 9188 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
- 2019-07-30 12:13:23.035 INFO 9188 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
- 2019-07-30 12:13:23.035 INFO 9188 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
- WARNING: An illegal reflective access operation has occurred
- WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/D:/repository/com/thoughtworks/xstream/xstream/1.4.10/xstream-1.4.10.jar) to field java.util.TreeMap.comparator
- WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
- WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
- WARNING: All illegal access operations will be denied in a future release
- 2019-07-30 12:13:23.093 INFO 9188 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
- 2019-07-30 12:13:23.093 INFO 9188 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
- 2019-07-30 12:13:23.175 INFO 9188 --- [ main] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
- 2019-07-30 12:13:23.207 INFO 9188 --- [ main] com.netflix.discovery.DiscoveryClient : Disable delta property : false
- 2019-07-30 12:13:23.207 INFO 9188 --- [ main] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
- 2019-07-30 12:13:23.207 INFO 9188 --- [ main] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
- 2019-07-30 12:13:23.208 INFO 9188 --- [ main] com.netflix.discovery.DiscoveryClient : Application is null : false
- 2019-07-30 12:13:23.208 INFO 9188 --- [ main] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
- 2019-07-30 12:13:23.208 INFO 9188 --- [ main] com.netflix.discovery.DiscoveryClient : Application version is -1: true
- 2019-07-30 12:13:23.208 INFO 9188 --- [ main] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
- 2019-07-30 12:13:23.299 INFO 9188 --- [ main] com.netflix.discovery.DiscoveryClient : The response status is 200
- 2019-07-30 12:13:23.300 INFO 9188 --- [ main] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
- 2019-07-30 12:13:23.302 INFO 9188 --- [ main] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
- 2019-07-30 12:13:23.303 INFO 9188 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1564460003303 with initial instances count: 0
- 2019-07-30 12:13:23.305 INFO 9188 --- [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application SPRING-CLOUD-FEIGN with eureka with status UP
- 2019-07-30 12:13:23.305 INFO 9188 --- [ main] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1564460003305, current=UP, previous=STARTING]
- 2019-07-30 12:13:23.305 INFO 9188 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_SPRING-CLOUD-FEIGN/172.20.202.43:spring-cloud-feign:8085: registering service...
- 2019-07-30 12:13:23.326 INFO 9188 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8085 (http) with context path ''
- 2019-07-30 12:13:23.326 INFO 9188 --- [ main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8085
- 2019-07-30 12:13:23.328 INFO 9188 --- [ main] com.zsx.FeignApplication : Started FeignApplication in 3.125 seconds (JVM running for 3.562)
- 2019-07-30 12:13:23.336 INFO 9188 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_SPRING-CLOUD-FEIGN/172.20.202.43:spring-cloud-feign:8085 - registration status: 204
- 2019-07-30 12:13:53.303 INFO 9188 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Disable delta property : false
- 2019-07-30 12:13:53.303 INFO 9188 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
- 2019-07-30 12:13:53.304 INFO 9188 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
- 2019-07-30 12:13:53.304 INFO 9188 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Application is null : false
- 2019-07-30 12:13:53.304 INFO 9188 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
- 2019-07-30 12:13:53.304 INFO 9188 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Application version is -1: false
- 2019-07-30 12:13:53.304 INFO 9188 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
- 2019-07-30 12:13:53.353 INFO 9188 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : The response status is 200
5. 查看注册中心
6. 查看Feign消费者http://localhost:8085/feign/hello
到此Feign熔断器配置完成
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。