第十九章 springboot + hystrix(1)
2016-05-20 13:35
495 查看
hystrix是微服务中用于做熔断、降级的工具。
作用:防止因为一个服务的调用失败、调用延时导致多个请求的阻塞以及多个请求的调用失败。
1、pom.xml(引入hystrix-core包)
View Code
测试:启动被调用服务-->启动调用服务
参考:
http://blog.csdn.net/xiaoyu411502/article/details/50601687 官方的中文总结
https://stonetingxin.gitbooks.io/hystrix/content/ 基本上是官方的中文翻译
https://github.com/Netflix/Hystrix/wiki/Configuration hystrix配置介绍
http://blog.vicoder.com/hystrix-configuration/ 配置介绍
http://www.insaneprogramming.be/blog/2014/08/19/hystrix-spring-boot/ boot集成hystrix
作用:防止因为一个服务的调用失败、调用延时导致多个请求的阻塞以及多个请求的调用失败。
1、pom.xml(引入hystrix-core包)
@RestController @RequestMapping("/hotel") @Api("HotelController相关api") public class HotelController { @ApiOperation("获取酒店Hotel信息:getHotelInfo") @RequestMapping(value="/getHotelInfo",method=RequestMethod.GET) public Hotel getHotelInfo(@RequestParam("id") int id, @RequestParam("name") String name) { // try { // TimeUnit.MILLISECONDS.sleep(2000);//用于测试超时 // } catch (InterruptedException e) { // e.printStackTrace(); // } return new Hotel(id, name); } }
View Code
测试:启动被调用服务-->启动调用服务
参考:
http://blog.csdn.net/xiaoyu411502/article/details/50601687 官方的中文总结
https://stonetingxin.gitbooks.io/hystrix/content/ 基本上是官方的中文翻译
https://github.com/Netflix/Hystrix/wiki/Configuration hystrix配置介绍
http://blog.vicoder.com/hystrix-configuration/ 配置介绍
http://www.insaneprogramming.be/blog/2014/08/19/hystrix-spring-boot/ boot集成hystrix
相关文章推荐
- SpringBoot中通过配置文件控制路径和变量(三)
- 通用DAO之MyBatis封装,封装通用的增删改查(一)
- SpringMVC深度探险(二) —— SpringMVC概览
- java中数字转化为中文大写(类似一,十,二十一,一百零一)
- Spring-IOC
- 学习SpringMVC(十二)之mvc:view-controller标签
- Android逆向之旅---动态方式破解apk前奏篇(Eclipse动态调试smail源码)
- spring 自定义标签实现传递list属性
- 关于使用运算符"||"、"&&"的小例子
- 如何解决eclipse android开发中的R cannot be resolved 的错误
- struts2中的几个技术
- spring boot集成data-jpa
- Java遍历文件夹下所有文件,并且将数据保存在数据库当中
- JavaSE入门学习44:文件传输基础之I/O流(三)
- Spring DATA JPA 中findAll 进行OrderBy
- Spring的父子容器问题
- java中void
- Spring 源码解析之HandlerAdapter源码解析(二)
- springmvc与struts2的区别
- Eclipse 常用快捷键