hystrix @EnableCircuitBreaker 在非弹簧启动应用程序中 [英] hystrix @EnableCircuitBreaker in a non spring boot application

查看:28
本文介绍了hystrix @EnableCircuitBreaker 在非弹簧启动应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于应用程序上下文 xml 文件(非 spring 启动)的简单 spring 项目.我如何为我的客户端使用 EnableCircuitBreaker 以便在我的 RestTemplate 中使用 hystrix 命令进行回退.

I have a simple spring project based on application context xml files (non spring boot). How do I use EnableCircuitBreaker for my client in order to use the hystrix command for fallback in my RestTemplate.

推荐答案

@EnableCircuitBreaker  

是 Spring Cloud 项目的一部分.它会为某些注解寻找某些类/方法来进行一些设置.但是你可以使用 Netflix hystrix 而不使用 spring cloud(spring boot).

is part of Spring cloud project. which looks for certain classes/methods for some Annotations to do some setup. But You can use Netflix hystrix without using spring cloud(spring boot) at all.

您需要扩展 HystrixCommand 类以提供断路器功能.
查看他们的 github 页面.它有很多细节.
https://github.com/Netflix/Hystrix/wiki/Getting-Started

You need to extendd HystrixCommand class where ever you want to provide circuitbreaker functionality.
Check out their github page. It has lot of details.
https://github.com/Netflix/Hystrix/wiki/Getting-Started

这篇关于hystrix @EnableCircuitBreaker 在非弹簧启动应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆