spring-cloud-feign

Spring Cloud Feign Client @RequestParam with List parameter creates a wrong request

[亡魂溺海] 提交于 2021-01-02 06:06:29
问题 I have a Spring Clound Feign Client mapping defined as following @RequestMapping(method = RequestMethod.GET, value = "/search/findByIdIn") Resources<MyClass> get(@RequestParam("ids") List<Long> ids); when I call feignClient.get(Arrays.asList(1L,2L,3L)) according to what I can see in the debugger, the feign-core library forms the following request: /search/findByIdIn?ids=1&ids=2&ids=3 instead of expected /search/findByIdIn?ids=1,2,3 which would be correct for the server Spring Data REST

how to pass Spring Pageable to FeignClient

旧巷老猫 提交于 2020-08-10 03:38:33
问题 as I wrote in this issue: https://github.com/spring-cloud/spring-cloud-openfeign/issues/375 and in this SO question: Spring data Pageable does not work with feign client I have some problems sending a Pageable object in a POST request containing a @requestbody element. First I tried sending the Pageable embedded in my RequestBody since it was generated as example when using springdoc-openapi-webmvc-core. Example: @PostMapping("/search") public Page<HelloDto> searchHellos(@RequestBody HelloDto

how to pass Spring Pageable to FeignClient

十年热恋 提交于 2020-08-10 03:38:15
问题 as I wrote in this issue: https://github.com/spring-cloud/spring-cloud-openfeign/issues/375 and in this SO question: Spring data Pageable does not work with feign client I have some problems sending a Pageable object in a POST request containing a @requestbody element. First I tried sending the Pageable embedded in my RequestBody since it was generated as example when using springdoc-openapi-webmvc-core. Example: @PostMapping("/search") public Page<HelloDto> searchHellos(@RequestBody HelloDto

Disable Hystrix for a single Feign client

送分小仙女□ 提交于 2020-08-06 12:45:54
问题 My SpringBoot app has Hystrix enabled with fallback defined for some of the Feign clients and undefined for the rest them. Now, I wanted to disable Hystrix for the ones that did not have a fallback defined as yet. So I followed the steps listed in [paragraph 7.4] https://cloud.spring.io/spring-cloud-netflix/multi/multi_spring-cloud-feign.html which is to create a separate Feign configuration with a vanilla Feign.Builder. However adding the new @Bean Feign.Builder disables my Hystrix

Disable Hystrix for a single Feign client

天涯浪子 提交于 2020-08-06 12:45:30
问题 My SpringBoot app has Hystrix enabled with fallback defined for some of the Feign clients and undefined for the rest them. Now, I wanted to disable Hystrix for the ones that did not have a fallback defined as yet. So I followed the steps listed in [paragraph 7.4] https://cloud.spring.io/spring-cloud-netflix/multi/multi_spring-cloud-feign.html which is to create a separate Feign configuration with a vanilla Feign.Builder. However adding the new @Bean Feign.Builder disables my Hystrix

Java: default value in Feign client

若如初见. 提交于 2020-06-29 04:26:14
问题 Tell me, how can I set the default value in a parameter in the Feign client or other? Here is my code. I indicated the default value, but it does not work :( Service: public Price get(PricesRequest request) { return priceFeignClient.get( request.getPrice(), request.getAddress(), request.getCode(), request.getCurrency() ) } Feign client: public interface PriceFeignClient { @GetMapping Price get(@RequestParam("price") String price, @RequestParam("address") String Address, @RequestParam(value =

How to POST form-url-encoded data with Spring Cloud Feign

北战南征 提交于 2020-06-09 17:04:47
问题 Using spring-mvc annotations, how can I define an @FeignClient that can POST form-url-encoded? 回答1: Use form encoder for feign: https://github.com/OpenFeign/feign-form and your feign configuration can look like this: class CoreFeignConfiguration { @Autowired private ObjectFactory<HttpMessageConverters> messageConverters @Bean @Primary @Scope(SCOPE_PROTOTYPE) Encoder feignFormEncoder() { new FormEncoder(new SpringEncoder(this.messageConverters)) } } Then, the client can be mapped like this:

Feign ErrorDecoder : retrieve the original message

僤鯓⒐⒋嵵緔 提交于 2020-05-10 04:39:09
问题 I use a ErrorDecoder to return the right exception rather than a 500 status code. Is there a way to retrieve the original message inside the decoder. I can see that it is inside the FeignException, but not in the decode method. All I have is the 'status code' and a empty 'reason'. public class CustomErrorDecoder implements ErrorDecoder { private final ErrorDecoder errorDecoder = new Default(); @Override public Exception decode(String s, Response response) { switch (response.status()) { case