Feign

Feign Client does not resolve Query parameter

自闭症网瘾萝莉.ら 提交于 2020-08-06 20:39:07
问题 Here is my interface. public interface SCIMServiceStub { @RequestLine("GET /Users/{id}") SCIMUser getUser(@Param("id") String id); @RequestLine("GET /Groups?filter=displayName+Eq+{roleName}") SCIMGroup isValidRole(@Param("roleName") String roleName); } Here getUser call works fine. But isValidRole is not working properly as the request is eventually sent like this. /Groups?filter=displayName+Eq+{roleName}" Here {roleName} is not resolved. What am I missing here? Appreciate some help, as I'm

How to pass Pageable to Feign Client in POST Request with additional @RequestBody

心不动则不痛 提交于 2020-08-05 09:38:12
问题 I tried to create a feign client for my REST service controller in Spring. @PostMapping("/search") public Page<MeasureDto> searchMeasures(@RequestBody MeasureDto example, Pageable pageable) { ... } The client looks like this: @PostMapping("/search") public Page<MeasureDto> searchMeasures(@RequestHeader("apiKey") String apiKey, @RequestBody MeasureDto example, Pageable pageable); Following exception is thrown when running a test: Caused by: java.lang.IllegalStateException: Method has too many

Feign ErrorDecoder not invoked

非 Y 不嫁゛ 提交于 2020-07-10 08:56:25
问题 Hello I created simple ErrorDecoder but it's not invoked: The configuration: @Bean UserClient userClient ( @Value( "${url}" ) final String url ) { return Feign .builder() .client( new OkHttpClient() ) .errorDecoder( new FeignErrorDecoder() ) .encoder( new GsonEncoder() ) .decoder( new GsonDecoder() ) .logger( new Slf4jLogger( UserClient.class ) ) .logLevel( Level.FULL ) .target( UserClient.class, url ); } ErrorDecoder: @Slf4j public class FeignErrorDecoder implements ErrorDecoder { @Override

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: