enablehystrixdashboard 怎么引用不了
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了enablehystrixdashboard 怎么引用不了相关的知识,希望对你有一定的参考价值。
参考技术A 引入依赖<!--hystrix-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<!--hystrix-dashboard 监控-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
123456789101112123456789101112
spring-cloud-starter-hystrix 核心jar
spring-cloud-starter-hystrix-dashboard 监控jar
EnableCircuitBreaker
使用EnableCircuitBreaker或者 EnableHystrix 表明Spring boot工程启用hystrix,两个注解是等价的.
Application.Java
package com.lkl.springcloud.hystrix;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
/**
* Created by liaokailin on 16/5/1.
*/
@SpringBootApplication
@EnableCircuitBreaker
@EnableHystrixDashboard
public class Application
public static void main(String[] args)
new SpringApplicationBuilder(Application.class).web(true).run(args);
12345678910111213141516171819201234567891011121314151617181920
其中EnableHystrixDashboard注解表示启动对hystrix的监控,后面会用到
随后模拟一个调用三方依赖服务
controller-> service -> dependency service
controller
package com.lkl.springcloud.hystrix.controller;
import com.lkl.springcloud.hystrix.service.HystrixService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 模拟一个对外的接口
* Created by liaokailin on 16/5/1.
*/
@RestController
public class HystrixController
@Autowired
private HystrixService service;
/**
* 调用依赖的服务
*/
@RequestMapping("/call")
public String callDependencyService()
return service.callDependencyService();
12345678910111213141516171819202122232425261234567891011121314151617181920212223242526
service本回答被提问者采纳 参考技术B 如果你想引入hystrix dashboard的依赖,请引入以下这个:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
另外目前Edgware.SR3 版本 官方给的依赖是这个
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-netflix-dashboard</artifactId>
</dependency>
是引不到的,我也遇到这样的问题了, 不知道以后会修复这个文档不
Aar怎么读?
参考技术A 直接读 A ar,/ei ar/ 参考技术B 这个是什么单词啊以上是关于enablehystrixdashboard 怎么引用不了的主要内容,如果未能解决你的问题,请参考以下文章