Fegin Hystrix does not effectiveDoes a finally block always get executed in Java?How does the Java 'for each' loop work?Does Java support default parameter values?Why does this code using random strings print “hello world”?Does Spring make the SecurityContext available to the thread executing a Hystrix CommandSeveral fallback implementations for some methods of a Hystrix-wrapped Feign client ( Spring Cloud Camden)Does Ribbon cache Eureka entries?java.lang.OutOfMemoryError on using Spring Boot WebFlux StarterHow to use Hystrix with Spring WebFlux WebClients?

Does immunity to damage from nonmagical attacks negate a rogue's Sneak Attack damage?

Go for an isolated pawn

Were the women of Travancore, India, taxed for covering their breasts by breast size?

Does POSIX guarantee the paths to any standard utilities?

Can a country avoid prosecution for crimes against humanity by denying it happened?

Does this bike use hydraulic brakes?

Do mortgage points get applied directly to the principal?

How will the UK Commons debate tonight despite the prorogation?

Global variables and information security

How many days for hunting?

Planet that’s 90% water or more?

Travel to USA with a stuffed puppet

How to anonymously report the Establishment Clause being broken?

How to describe hit point damage without talking about wounds

Spare the Dying during Rage Beyond Death

In-universe, why does Doc Brown program the time machine to go to 1955?

Did the US Climate Reference Network Show No New Warming Since 2005 in the US?

Is it possible to observe space debris with Binoculars?

Can there be plants on the dark side of a tidally locked world?

My boss says "This will help us better view the utilization of your services." Does this mean my job is ending in this organisation?

What exactly is a softlock?

Which is the best password hashing algorithm in .NET Core?

How to encode a class with 24,000 categories?

Are treasury bonds more liquid than USD?



Fegin Hystrix does not effective


Does a finally block always get executed in Java?How does the Java 'for each' loop work?Does Java support default parameter values?Why does this code using random strings print “hello world”?Does Spring make the SecurityContext available to the thread executing a Hystrix CommandSeveral fallback implementations for some methods of a Hystrix-wrapped Feign client ( Spring Cloud Camden)Does Ribbon cache Eureka entries?java.lang.OutOfMemoryError on using Spring Boot WebFlux StarterHow to use Hystrix with Spring WebFlux WebClients?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I tried Feign to configure Hystrix. Enter 127.0.0.1:8100/test in the browser address bar. No matter whether it is configured with fallback or fallbackFactory, the result of the prompt is: "com.netflix.client.ClientException: Load balancer does not have available server for client: microservice-provider-user", this Explain that fallback is not working.



Controller




@Import(FeignClientsConfiguration.class)
@RestController
public class TestController

private UserFeignClient userFeignClient;

private UserFeignClient adminFeignClient;

@Autowired
public TestController(Decoder decoder, Encoder encoder, Client client, Contract contract)
this.userFeignClient = Feign.builder().client(client).encoder(encoder)
.decoder(decoder).contract(contract)
.requestInterceptor(new BasicAuthRequestInterceptor("user", "user"))
.target(UserFeignClient.class, "http://microservice-provider-user/");

this.adminFeignClient = Feign.builder().client(client).encoder(encoder)
.decoder(decoder).contract(contract)
.requestInterceptor(new BasicAuthRequestInterceptor("admin", "admin"))
.target(UserFeignClient.class, "http://microservice-provider-user/");


@GetMapping("/test")
@ResponseBody
public String test()
return userFeignClient.findById(123L);


@GetMapping("/testAdmin")
@ResponseBody
public String test2()
return adminFeignClient.findById(123L);





Main method




@SpringBootApplication
@EnableFeignClients
@EnableHystrixDashboard
@EnableHystrix
@EnableCircuitBreaker
public class Demo2Application

public static void main(String[] args)
SpringApplication.run(Demo2Application.class, args);






fallback



@Component
public class FeignClientFallback implements UserFeignClient
@Override
public String findById(Long id)
return "hello FeignClientFallback";




gradle



plugins 
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'java'


apply plugin: 'io.spring.dependency-management'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories
mavenCentral()


ext
set('springCloudServicesVersion', '2.1.2.RELEASE')
set('springCloudVersion', 'Greenwich.SR1')


dependencies
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix-dashboard'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-turbine'
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
testImplementation 'org.springframework.boot:spring-boot-starter-test'


dependencyManagement
imports
mavenBom "io.pivotal.spring.cloud:spring-cloud-services-dependencies:$springCloudServicesVersion"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion"





Feign client



@FeignClient(name = "microservice-provider-user", fallback = FeignClientFallback.class)
public interface UserFeignClient

@GetMapping("/test2/id")
String findById(@PathVariable("id") Long id);




application.yml



spring:
application:
name: microservice-custom
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/
healthcheck:
enabled: true
instance:
prefer-ip-address: true

server:
port: 8100

feign:
hystrix:
enabled: true
client:
config:
default:
connectTimeout: 1000
readTimeout: 1000
loggerLevel: basic

hystrix:
command:
default:
execution:
isolation:
strategy: SEMAPHORE

logging:
level:
com.lv.springCloudClient1.UserFeignClient: DEBUG

management:
endpoints:
web:
exposure:
include: '*'



In theory, if I turn off the "microservice-provider-user" server, I will get the content returned by the fallback method.










share|improve this question
























  • Confirm whether eureka server has a service with name microservice-provider-user shown. Provide full logs

    – Barath
    Mar 28 at 5:54











  • eureka server page only display MICROSERVICE-CUSTOMX n/a (1) (1) UP (1) - 192.168.2.31:microservice-customx:8100 because microservice-provider-user has been shut down

    – lvqiang
    Mar 28 at 8:32












  • ok so thats why it is throwing error, try to bring it up and test whether it works.

    – Barath
    Mar 28 at 8:33











  • But the result I expect is the return value of the findById method in the FeignClientFallback class. In theory, I shut down the microservice-provider-user service. The return value should not be Load balancer does not have available server for client. Isn't it?

    – lvqiang
    Mar 28 at 8:54












  • Confused. You created feign clients manually using java DSL that could be the reason advise is not working

    – Barath
    Mar 28 at 9:02

















0















I tried Feign to configure Hystrix. Enter 127.0.0.1:8100/test in the browser address bar. No matter whether it is configured with fallback or fallbackFactory, the result of the prompt is: "com.netflix.client.ClientException: Load balancer does not have available server for client: microservice-provider-user", this Explain that fallback is not working.



Controller




@Import(FeignClientsConfiguration.class)
@RestController
public class TestController

private UserFeignClient userFeignClient;

private UserFeignClient adminFeignClient;

@Autowired
public TestController(Decoder decoder, Encoder encoder, Client client, Contract contract)
this.userFeignClient = Feign.builder().client(client).encoder(encoder)
.decoder(decoder).contract(contract)
.requestInterceptor(new BasicAuthRequestInterceptor("user", "user"))
.target(UserFeignClient.class, "http://microservice-provider-user/");

this.adminFeignClient = Feign.builder().client(client).encoder(encoder)
.decoder(decoder).contract(contract)
.requestInterceptor(new BasicAuthRequestInterceptor("admin", "admin"))
.target(UserFeignClient.class, "http://microservice-provider-user/");


@GetMapping("/test")
@ResponseBody
public String test()
return userFeignClient.findById(123L);


@GetMapping("/testAdmin")
@ResponseBody
public String test2()
return adminFeignClient.findById(123L);





Main method




@SpringBootApplication
@EnableFeignClients
@EnableHystrixDashboard
@EnableHystrix
@EnableCircuitBreaker
public class Demo2Application

public static void main(String[] args)
SpringApplication.run(Demo2Application.class, args);






fallback



@Component
public class FeignClientFallback implements UserFeignClient
@Override
public String findById(Long id)
return "hello FeignClientFallback";




gradle



plugins 
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'java'


apply plugin: 'io.spring.dependency-management'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories
mavenCentral()


ext
set('springCloudServicesVersion', '2.1.2.RELEASE')
set('springCloudVersion', 'Greenwich.SR1')


dependencies
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix-dashboard'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-turbine'
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
testImplementation 'org.springframework.boot:spring-boot-starter-test'


dependencyManagement
imports
mavenBom "io.pivotal.spring.cloud:spring-cloud-services-dependencies:$springCloudServicesVersion"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion"





Feign client



@FeignClient(name = "microservice-provider-user", fallback = FeignClientFallback.class)
public interface UserFeignClient

@GetMapping("/test2/id")
String findById(@PathVariable("id") Long id);




application.yml



spring:
application:
name: microservice-custom
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/
healthcheck:
enabled: true
instance:
prefer-ip-address: true

server:
port: 8100

feign:
hystrix:
enabled: true
client:
config:
default:
connectTimeout: 1000
readTimeout: 1000
loggerLevel: basic

hystrix:
command:
default:
execution:
isolation:
strategy: SEMAPHORE

logging:
level:
com.lv.springCloudClient1.UserFeignClient: DEBUG

management:
endpoints:
web:
exposure:
include: '*'



In theory, if I turn off the "microservice-provider-user" server, I will get the content returned by the fallback method.










share|improve this question
























  • Confirm whether eureka server has a service with name microservice-provider-user shown. Provide full logs

    – Barath
    Mar 28 at 5:54











  • eureka server page only display MICROSERVICE-CUSTOMX n/a (1) (1) UP (1) - 192.168.2.31:microservice-customx:8100 because microservice-provider-user has been shut down

    – lvqiang
    Mar 28 at 8:32












  • ok so thats why it is throwing error, try to bring it up and test whether it works.

    – Barath
    Mar 28 at 8:33











  • But the result I expect is the return value of the findById method in the FeignClientFallback class. In theory, I shut down the microservice-provider-user service. The return value should not be Load balancer does not have available server for client. Isn't it?

    – lvqiang
    Mar 28 at 8:54












  • Confused. You created feign clients manually using java DSL that could be the reason advise is not working

    – Barath
    Mar 28 at 9:02













0












0








0








I tried Feign to configure Hystrix. Enter 127.0.0.1:8100/test in the browser address bar. No matter whether it is configured with fallback or fallbackFactory, the result of the prompt is: "com.netflix.client.ClientException: Load balancer does not have available server for client: microservice-provider-user", this Explain that fallback is not working.



Controller




@Import(FeignClientsConfiguration.class)
@RestController
public class TestController

private UserFeignClient userFeignClient;

private UserFeignClient adminFeignClient;

@Autowired
public TestController(Decoder decoder, Encoder encoder, Client client, Contract contract)
this.userFeignClient = Feign.builder().client(client).encoder(encoder)
.decoder(decoder).contract(contract)
.requestInterceptor(new BasicAuthRequestInterceptor("user", "user"))
.target(UserFeignClient.class, "http://microservice-provider-user/");

this.adminFeignClient = Feign.builder().client(client).encoder(encoder)
.decoder(decoder).contract(contract)
.requestInterceptor(new BasicAuthRequestInterceptor("admin", "admin"))
.target(UserFeignClient.class, "http://microservice-provider-user/");


@GetMapping("/test")
@ResponseBody
public String test()
return userFeignClient.findById(123L);


@GetMapping("/testAdmin")
@ResponseBody
public String test2()
return adminFeignClient.findById(123L);





Main method




@SpringBootApplication
@EnableFeignClients
@EnableHystrixDashboard
@EnableHystrix
@EnableCircuitBreaker
public class Demo2Application

public static void main(String[] args)
SpringApplication.run(Demo2Application.class, args);






fallback



@Component
public class FeignClientFallback implements UserFeignClient
@Override
public String findById(Long id)
return "hello FeignClientFallback";




gradle



plugins 
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'java'


apply plugin: 'io.spring.dependency-management'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories
mavenCentral()


ext
set('springCloudServicesVersion', '2.1.2.RELEASE')
set('springCloudVersion', 'Greenwich.SR1')


dependencies
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix-dashboard'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-turbine'
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
testImplementation 'org.springframework.boot:spring-boot-starter-test'


dependencyManagement
imports
mavenBom "io.pivotal.spring.cloud:spring-cloud-services-dependencies:$springCloudServicesVersion"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion"





Feign client



@FeignClient(name = "microservice-provider-user", fallback = FeignClientFallback.class)
public interface UserFeignClient

@GetMapping("/test2/id")
String findById(@PathVariable("id") Long id);




application.yml



spring:
application:
name: microservice-custom
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/
healthcheck:
enabled: true
instance:
prefer-ip-address: true

server:
port: 8100

feign:
hystrix:
enabled: true
client:
config:
default:
connectTimeout: 1000
readTimeout: 1000
loggerLevel: basic

hystrix:
command:
default:
execution:
isolation:
strategy: SEMAPHORE

logging:
level:
com.lv.springCloudClient1.UserFeignClient: DEBUG

management:
endpoints:
web:
exposure:
include: '*'



In theory, if I turn off the "microservice-provider-user" server, I will get the content returned by the fallback method.










share|improve this question














I tried Feign to configure Hystrix. Enter 127.0.0.1:8100/test in the browser address bar. No matter whether it is configured with fallback or fallbackFactory, the result of the prompt is: "com.netflix.client.ClientException: Load balancer does not have available server for client: microservice-provider-user", this Explain that fallback is not working.



Controller




@Import(FeignClientsConfiguration.class)
@RestController
public class TestController

private UserFeignClient userFeignClient;

private UserFeignClient adminFeignClient;

@Autowired
public TestController(Decoder decoder, Encoder encoder, Client client, Contract contract)
this.userFeignClient = Feign.builder().client(client).encoder(encoder)
.decoder(decoder).contract(contract)
.requestInterceptor(new BasicAuthRequestInterceptor("user", "user"))
.target(UserFeignClient.class, "http://microservice-provider-user/");

this.adminFeignClient = Feign.builder().client(client).encoder(encoder)
.decoder(decoder).contract(contract)
.requestInterceptor(new BasicAuthRequestInterceptor("admin", "admin"))
.target(UserFeignClient.class, "http://microservice-provider-user/");


@GetMapping("/test")
@ResponseBody
public String test()
return userFeignClient.findById(123L);


@GetMapping("/testAdmin")
@ResponseBody
public String test2()
return adminFeignClient.findById(123L);





Main method




@SpringBootApplication
@EnableFeignClients
@EnableHystrixDashboard
@EnableHystrix
@EnableCircuitBreaker
public class Demo2Application

public static void main(String[] args)
SpringApplication.run(Demo2Application.class, args);






fallback



@Component
public class FeignClientFallback implements UserFeignClient
@Override
public String findById(Long id)
return "hello FeignClientFallback";




gradle



plugins 
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'java'


apply plugin: 'io.spring.dependency-management'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories
mavenCentral()


ext
set('springCloudServicesVersion', '2.1.2.RELEASE')
set('springCloudVersion', 'Greenwich.SR1')


dependencies
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix-dashboard'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-turbine'
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
testImplementation 'org.springframework.boot:spring-boot-starter-test'


dependencyManagement
imports
mavenBom "io.pivotal.spring.cloud:spring-cloud-services-dependencies:$springCloudServicesVersion"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion"





Feign client



@FeignClient(name = "microservice-provider-user", fallback = FeignClientFallback.class)
public interface UserFeignClient

@GetMapping("/test2/id")
String findById(@PathVariable("id") Long id);




application.yml



spring:
application:
name: microservice-custom
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/
healthcheck:
enabled: true
instance:
prefer-ip-address: true

server:
port: 8100

feign:
hystrix:
enabled: true
client:
config:
default:
connectTimeout: 1000
readTimeout: 1000
loggerLevel: basic

hystrix:
command:
default:
execution:
isolation:
strategy: SEMAPHORE

logging:
level:
com.lv.springCloudClient1.UserFeignClient: DEBUG

management:
endpoints:
web:
exposure:
include: '*'



In theory, if I turn off the "microservice-provider-user" server, I will get the content returned by the fallback method.







java spring hystrix feign






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 3:20









lvqianglvqiang

11




11















  • Confirm whether eureka server has a service with name microservice-provider-user shown. Provide full logs

    – Barath
    Mar 28 at 5:54











  • eureka server page only display MICROSERVICE-CUSTOMX n/a (1) (1) UP (1) - 192.168.2.31:microservice-customx:8100 because microservice-provider-user has been shut down

    – lvqiang
    Mar 28 at 8:32












  • ok so thats why it is throwing error, try to bring it up and test whether it works.

    – Barath
    Mar 28 at 8:33











  • But the result I expect is the return value of the findById method in the FeignClientFallback class. In theory, I shut down the microservice-provider-user service. The return value should not be Load balancer does not have available server for client. Isn't it?

    – lvqiang
    Mar 28 at 8:54












  • Confused. You created feign clients manually using java DSL that could be the reason advise is not working

    – Barath
    Mar 28 at 9:02

















  • Confirm whether eureka server has a service with name microservice-provider-user shown. Provide full logs

    – Barath
    Mar 28 at 5:54











  • eureka server page only display MICROSERVICE-CUSTOMX n/a (1) (1) UP (1) - 192.168.2.31:microservice-customx:8100 because microservice-provider-user has been shut down

    – lvqiang
    Mar 28 at 8:32












  • ok so thats why it is throwing error, try to bring it up and test whether it works.

    – Barath
    Mar 28 at 8:33











  • But the result I expect is the return value of the findById method in the FeignClientFallback class. In theory, I shut down the microservice-provider-user service. The return value should not be Load balancer does not have available server for client. Isn't it?

    – lvqiang
    Mar 28 at 8:54












  • Confused. You created feign clients manually using java DSL that could be the reason advise is not working

    – Barath
    Mar 28 at 9:02
















Confirm whether eureka server has a service with name microservice-provider-user shown. Provide full logs

– Barath
Mar 28 at 5:54





Confirm whether eureka server has a service with name microservice-provider-user shown. Provide full logs

– Barath
Mar 28 at 5:54













eureka server page only display MICROSERVICE-CUSTOMX n/a (1) (1) UP (1) - 192.168.2.31:microservice-customx:8100 because microservice-provider-user has been shut down

– lvqiang
Mar 28 at 8:32






eureka server page only display MICROSERVICE-CUSTOMX n/a (1) (1) UP (1) - 192.168.2.31:microservice-customx:8100 because microservice-provider-user has been shut down

– lvqiang
Mar 28 at 8:32














ok so thats why it is throwing error, try to bring it up and test whether it works.

– Barath
Mar 28 at 8:33





ok so thats why it is throwing error, try to bring it up and test whether it works.

– Barath
Mar 28 at 8:33













But the result I expect is the return value of the findById method in the FeignClientFallback class. In theory, I shut down the microservice-provider-user service. The return value should not be Load balancer does not have available server for client. Isn't it?

– lvqiang
Mar 28 at 8:54






But the result I expect is the return value of the findById method in the FeignClientFallback class. In theory, I shut down the microservice-provider-user service. The return value should not be Load balancer does not have available server for client. Isn't it?

– lvqiang
Mar 28 at 8:54














Confused. You created feign clients manually using java DSL that could be the reason advise is not working

– Barath
Mar 28 at 9:02





Confused. You created feign clients manually using java DSL that could be the reason advise is not working

– Barath
Mar 28 at 9:02












1 Answer
1






active

oldest

votes


















0

















@Import(FeignClientsConfiguration.class)
@RestController
public class TestController

@Autowired
private UserFeignClient userFeignClient;

@Autowired
private UserFeignClient adminFeignClient;

@GetMapping("/test")
@ResponseBody
public String test()
return userFeignClient.findById(123L);


@GetMapping("/testAdmin")
@ResponseBody
public String test2()
return adminFeignClient.findById(123L);





I changed the previous controller code to the current one.
the Hystrix fallback method is effective.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389670%2ffegin-hystrix-does-not-effective%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0

















    @Import(FeignClientsConfiguration.class)
    @RestController
    public class TestController

    @Autowired
    private UserFeignClient userFeignClient;

    @Autowired
    private UserFeignClient adminFeignClient;

    @GetMapping("/test")
    @ResponseBody
    public String test()
    return userFeignClient.findById(123L);


    @GetMapping("/testAdmin")
    @ResponseBody
    public String test2()
    return adminFeignClient.findById(123L);





    I changed the previous controller code to the current one.
    the Hystrix fallback method is effective.






    share|improve this answer





























      0

















      @Import(FeignClientsConfiguration.class)
      @RestController
      public class TestController

      @Autowired
      private UserFeignClient userFeignClient;

      @Autowired
      private UserFeignClient adminFeignClient;

      @GetMapping("/test")
      @ResponseBody
      public String test()
      return userFeignClient.findById(123L);


      @GetMapping("/testAdmin")
      @ResponseBody
      public String test2()
      return adminFeignClient.findById(123L);





      I changed the previous controller code to the current one.
      the Hystrix fallback method is effective.






      share|improve this answer



























        0














        0










        0










        @Import(FeignClientsConfiguration.class)
        @RestController
        public class TestController

        @Autowired
        private UserFeignClient userFeignClient;

        @Autowired
        private UserFeignClient adminFeignClient;

        @GetMapping("/test")
        @ResponseBody
        public String test()
        return userFeignClient.findById(123L);


        @GetMapping("/testAdmin")
        @ResponseBody
        public String test2()
        return adminFeignClient.findById(123L);





        I changed the previous controller code to the current one.
        the Hystrix fallback method is effective.






        share|improve this answer














        @Import(FeignClientsConfiguration.class)
        @RestController
        public class TestController

        @Autowired
        private UserFeignClient userFeignClient;

        @Autowired
        private UserFeignClient adminFeignClient;

        @GetMapping("/test")
        @ResponseBody
        public String test()
        return userFeignClient.findById(123L);


        @GetMapping("/testAdmin")
        @ResponseBody
        public String test2()
        return adminFeignClient.findById(123L);





        I changed the previous controller code to the current one.
        the Hystrix fallback method is effective.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 28 at 9:21









        lvqianglvqiang

        11




        11





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389670%2ffegin-hystrix-does-not-effective%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현