My Environment:
1 Spring Cloud (FINCHLEY.SR1) based on spring boot 2.0.4
2. Divided into Eureka,merber,order. Order a way to call Merber by Fegin
confused:
remote invocation using annotations @hystrixcommand The fuse can work,
But it doesn't work that way.
Code Show:
Pom.xml
<?xml version= "1.0" encoding= "UTF-8"? ><project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http ://www.w3.org/2001/XMLSchema-instance "xsi:schemalocation=" http://maven.apache.org/POM/4.0.0 Http://maven.apache . org/xsd/maven-4.0.0.xsd "> <modelVersion>4.0.0</modelVersion> <groupid>com.msop.order</ groupid> <artifactId>order</artifactId> <version>0.0.1-SNAPSHOT</version> <packagin G>jar</packaging> <name>order</name> <description>demo Project for Spring BOOT</DESCRI ption> <parent> <groupId>org.springframework.boot</groupId> <artifactid>spring-bo Ot-starter-parent</artifactid> <version>2.0.4.RELEASE</version> <relativePath/> < !--Lookup parent from repository-</parent> <properties> <project.build.sourceencoding& Gt Utf-8</project.build.sourceencodinG> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.versio N>1.8</java.version> <spring-cloud.version>Finchley.SR1</spring-cloud.version> </propert ies> <dependencies> <dependency> <GROUPID>ORG.SPRINGFRAMEWORK.BOOT</GROUPID&G T <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactid>spring-cloud-starter-netflix-eure ka-client</artifactid> </dependency> <dependency> <groupid>org.springfram Ework.cloud</groupid> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> &L T;/dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactid>spring-cloud-starter-openfeign</artifactid> </dependency> </dependencies> <depe ndencymanagement> <dependencies> <dependency> <groupid>org.springfra Mework.cloud</groupid> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scop e>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupid>org.springframework.boot</ Groupid> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build></project>
Application.properties
spring.application.name=orderserver.port=3001server.tomcat.max-threads=20eureka.client.service-url.defaultZone=http://localhost:1001/eureka/fegin.hystrix.enabled=truehystrix.command.default.exection.isolation.thread.timeoutInMilliseconds=4000ribbon.ReadTimeOut=4000ribbon.ConnectTimeOut=4000
Orderapplication Startup file
Fegin Interface File
Fegin Fallback class
Control files
Consult with Fegin for remote access settings Hystrix fuse does not take effect