0
我在我的spring啓動應用程序中使用hystrix,但是當我訪問/hystrix-stream頁面時,沒有數據。它只顯示「ping:」。 在我的pom.xml我有以下幾點:Spring Cloud:Hystrix在ping上沒有顯示數據
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
我已經啓用蝟和HystrixDashboard。此外,我在我的應用程序中使用功能區。該HystrixCommand看起來是這樣的:
@HystrixCommand(fallbackMethod = "defaultFallback")
public byte[] doGet() {
return this.restTemplate.getForObject("http://myInstance/api/v3/ressource",byte[].class);
}
public byte[] defaultFallback() {
System.out.println("Now doing fallback!");
return null;
}
當我關閉將myInstance沒有後備調用,色帶顯示我只有這個失敗:
There was an unexpected error (type=Internal Server Error, status=500).
I/O error on POST request for "http:/myInstance/api/v3/ressource": Connection
refused; nested exception is java.net.ConnectException: Connection refused
從你在哪裏調用doGet方法?來自同一班還是來自外班? –
你有整個堆棧跟蹤嗎? –