spring-cloud-feign

Define different Feign client implementations based on environment

 ̄綄美尐妖づ 提交于 2020-03-18 06:22:48
问题 I have a Spring boot application which uses Feign to call an external web service via Eureka. I'd like to be able to run the application using a mocked out implementation of the Feign interface, so I can run the application locally without necessarily having Eureka or the external web service running. I had imagined defining a run configuration that allowed me to do this, but am struggling to get this working. The issue is that the Spring "magic" is defining a bean for the Feign interface no

spring boot application failed to autowired feign client

谁说我不能喝 提交于 2020-02-04 02:29:29
问题 created a sample project of spring boot application to understand the feign client functionality, when run it gives below error. Description: Field remoteCallClient in com.example.demo.RestClient required a bean of type 'com.example.demo.RemoteCallClient' that could not be found. Action: Consider defining a bean of type 'com.example.demo.RemoteCallClient' in your configuration. I tried various ways but it could not resolved, provided entire source code of sample project. POM.xml <?xml version

Can't configure Feign Client timeouts

 ̄綄美尐妖づ 提交于 2020-02-02 14:57:49
问题 I'm using Feign Client with disabled Load Balancer @FeignClient(name = "my-client", url = "${myHost}", configuration = ClientContext.class) So, all ribbon properties are ignored. I'm trying to set custom timeouts by different ways, but Feign ignores all them and throws TimeoutException after 60 seconds. Ways I tried to use: in ClientContext: 1) @Value("${feign.connectTimeout:10000}") private int connectTimeout; @Value("${feign.readTimeOut:300000}") private int readTimeout; @Bean public

spring boot 2 + feign + eureka client wont resolve service-name to URL

时间秒杀一切 提交于 2020-01-24 17:03:37
问题 I am trying spring-boot (2.0.5) with spring-cloud (Finchley.SR1) and trying to setup communication between two services using Eureka as discovery server and Feign/Ribbon as clients. The setup is quite straightforward (although a bit muddied by the various things and other answers I tried): Eureka's application.yml spring: application: name: eureka-service server: port: 8761 eureka: instance: hostname: localhost preferIpAddress: true client: registerWithEureka: false fetchRegistry: false

Spring Data Pageable not supported as RequestParam in Feign Client

。_饼干妹妹 提交于 2020-01-13 06:09:08
问题 I have been trying to expose a Feign Client for my rest api. It takes Pageable as input and has PageDefaults defined. Controller: @GetMapping(value = "data", produces = MediaType.APPLICATION_JSON_VALUE) @ApiOperation(value = "Get Data", nickname = "getData") public Page<Data> getData(@PageableDefault(size = 10, page = 0) Pageable page, @RequestParam(value = "search", required = false) String search) { return service.getData(search, page); } And here is my feign client: @RequestMapping(method

Spring boot Oauth2 : Token relay from a client using Feign, Ribbon, Zull and Eureka to a ressource

百般思念 提交于 2020-01-06 04:46:05
问题 I have an oauth2 client that get a token from an authorization server successfully. (not always has been the case but now it is... :)) The client, the zuul gateway and the resource server are all registered in Eureka. My client use a Proxy to access to a remote ressource service named microservice-files. @RestController @FeignClient(name = "zuul-server") @RibbonClient(name = "microservice-files") public interface ProxyMicroserviceFiles { @GetMapping(value = "microservice-files/root") FileBean

NullPointerException in LoadBalancerFeignClient (spring-cloud-netflix)

独自空忆成欢 提交于 2020-01-04 17:45:31
问题 We are using Feign for our clients in our services. Recently one of the services started to randomly throw some exceptions which is caused by: Caused by: java.lang.NullPointerException: null at org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:63) at org.springframework.cloud.sleuth.instrument.web.client.feign.TraceLoadBalancerFeignClient.execute(TraceLoadBalancerFeignClient.java:41) at feign.SynchronousMethodHandler.executeAndDecode

Spring cloud Zuul retry when instance is down and forward to other available instance

你。 提交于 2020-01-02 04:01:32
问题 using 'Camden.SR5' for spring-cloud-dependencies, with spring boot '1.5.2.RELEASE'. In my current setup, I have eureka server config server (running on random ports) zuul gateway server and 2 instances of a service (running on random ports) All these instances are successfully register with Eureka. When all the services are running, The load balancing is done properly through zuul without any issues. when an instance is killed, Zuul is still trying to fulfil the request using the same service

Spring @FeignClient , OAuth2 and @Scheduled not working

无人久伴 提交于 2019-12-21 20:56:45
问题 Added OAuth2FeignRequestInterceptor to handle OAuth2 @FeignClient request and I'm now seeing the following exception: *org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.oauth2ClientContext': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to

Can I generate a Spring Feign client with Multipart parameters?

北城余情 提交于 2019-12-19 07:32:15
问题 I am getting the error: "Method has too many Body parameters" when trying to generate a Spring Feign client @RequestMapping(value="/media", method=RequestMethod.POST) String uploadMedia(@RequestHeader("Authentication") String token, @RequestPart("media") MultipartFile audio, @RequestPart("a-json-object") SomeClass someClazz, @RequestPart("another-json-object") AnotherClass anotherClazz); I found the following solution, which works when using regular Feign annotations, but not with Spring MVC