Spring Cloud----> ribbonclient set fuse hystrix does not work

Source: Internet
Author: User

Ribbon

Spring.io's official Website profile:

The Ribbon is a client side load balancer which gives your a lot of control over the behaviour of HTTP and TCP clients.

Your own translation:

The Ribbon is a client for load balancing, and the Ribbon can give you a lot of control over HTTP and TCP client behavior.

The fuse was found to be hystrix when the fuse was set to the Ribbon.

The code is as follows:

Example Reference Source: http://blog.csdn.net/forezp/article/details/69934399

1  PackageCom.example.demo;2 3 Importorg.springframework.boot.SpringApplication;4 Importorg.springframework.boot.autoconfigure.SpringBootApplication;5 ImportOrg.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;6 Importorg.springframework.cloud.client.discovery.EnableDiscoveryClient;7 Importorg.springframework.cloud.client.loadbalancer.LoadBalanced;8 ImportOrg.springframework.cloud.netflix.hystrix.EnableHystrix;9 ImportOrg.springframework.context.annotation.Bean;Ten Importorg.springframework.web.client.RestTemplate; One /** A * To register with the service centre through @EnableDiscoveryClient in the commencement class of the project; - * and inject a bean:resttemplate into the IOC of the program; - * and through @LoadBalanced annotations indicate that the restremplate is enabled for load balancing.  the  *  -  *  - * Use of fuses - * in the program start class ribbonclientapplication add @EnableHystrix annotation Open Hystrix does not work  +  *  -  * +  */ A @SpringBootApplication at@EnableDiscoveryClient//..... - //@EnableHystrix//......//annotations do not work - @EnableCircuitBreaker //annotations work, see official documentation  -  Public classribbonclientapplication { -  -      Public Static voidMain (string[] args) { inSpringapplication.run (ribbonclientapplication.class, args); -     } to      +@LoadBalanced//...... - @Bean the      Publicresttemplate resttemplate () { *         return Newresttemplate (); $     }Panax Notoginseng}

Spring Cloud----> ribbonclient set fuse hystrix does not work

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.