Feign

How to set custom Feign client connection timeout?

流过昼夜 提交于 2020-04-07 14:20:34
问题 I have Spring Boot application with this Gradle dependencies: compile("org.springframework.cloud:spring-cloud-starter-eureka") compile("org.springframework.cloud:spring-cloud-starter-feign") compile("org.springframework.cloud:spring-cloud-starter-ribbon") compile("org.springframework.cloud:spring-cloud-starter-hystrix") compile("org.springframework.cloud:spring-cloud-starter-config") Also I have Feign client: @FeignClient(name = "client") public interface FeignService { @RequestMapping(value

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

Adding decodeSlash using Feign @RequestLine

瘦欲@ 提交于 2020-01-15 15:56:49
问题 I am currently using a YAML file to generate the models and the API clients using the swagger plugin and I am using Feign OkHttpClient to make requests to the API, the problem here is the client encodes the URL but ignores the Slash(es) with this the API call fails. Is there a way to add decodeSlash parameter in the client? Or can this be achieved using an interceptor? Here is the sample path param where I am running into this issue. QgKuK2DU/0%3D where as it should be QgKuK2DU%2F0%3D 回答1:

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

Feign Client and name from properties

情到浓时终转凉″ 提交于 2020-01-05 03:33:49
问题 I have sth like this, @FeignClient(name = "${airport.service.name}") And I have compilation error like, java.lang.IllegalStateException: Service id not legal hostname (${airport.service.name}) The question is how can I pass hostname form applciation.yaml to FeignClient? 回答1: Though it is late, I am updating my answer since I faced this exception (java.lang.IllegalStateException: Service id not legal hostname) while using feign client in spring cloud The root cause is feign client won't accept

Body parameters cannot be used with form parameters - Feign client with Headers and json data

China☆狼群 提交于 2020-01-02 02:19:23
问题 I have a FeignClient like this @RequestLine("POST /enroll") @Headers({ "header1: {header1}", "header2: {header2}", "Content-Type: application/json" }) ResponseDto enroll(@Param("header1") String header1,@Param("header1") String header1, RequestDto requestDto)throws MyCustomException; ` I am not using spring cloud netflix. But I am keep getting the below exception. Caused by: java.lang.IllegalStateException: Body parameters cannot be used with form parameters. at feign.Util.checkState(Util

Feign logging not working

自闭症网瘾萝莉.ら 提交于 2020-01-01 07:41:44
问题 I'm trying to get logging working for each request from a Feign rest client. However I cannot get the logging to work, while 'standard' Slf4j logging does work. I have the following: public MyClient() { initConnectionProperties(); this.service = Feign.builder() .contract(new JAXRSContract()) .decoder(getJacksonDecoder()) .encoder(getJacksonEncoder()) .requestInterceptor(new BasicAuthRequestInterceptor(user, password)) //.client(new OkHttpClient()) .logger(new Slf4jLogger(MyClient.class)) /

Feign logging not working

不问归期 提交于 2020-01-01 07:41:08
问题 I'm trying to get logging working for each request from a Feign rest client. However I cannot get the logging to work, while 'standard' Slf4j logging does work. I have the following: public MyClient() { initConnectionProperties(); this.service = Feign.builder() .contract(new JAXRSContract()) .decoder(getJacksonDecoder()) .encoder(getJacksonEncoder()) .requestInterceptor(new BasicAuthRequestInterceptor(user, password)) //.client(new OkHttpClient()) .logger(new Slf4jLogger(MyClient.class)) /

File upload spring cloud feign client

非 Y 不嫁゛ 提交于 2020-01-01 07:21:32
问题 When make a post request from one microservice to another using feign client of spring cloud netflix, I get the following error in Postman : { "timestamp": 1506933777413, "status": 500, "error": "Internal Server Error", "exception": "feign.codec.EncodeException", "message": "Could not write JSON: No serializer found for class java.io.FileDescriptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS); nested exception is

Feign jackson dateTime JsonMappingException

浪尽此生 提交于 2019-12-25 02:46:34
问题 I've got two services that are communicating with openfeign (github.openfeign:10.2.0). I'm forcing problem with deserializing datatime that is sent as JSON. Here is my configuration: @Configuration class JacksonConfig : WebMvcConfigurerAdapter() { override fun extendMessageConverters(converters: List<HttpMessageConverter<*>>?) { for (converter in converters!!) { if (converter is MappingJackson2HttpMessageConverter) { val objectMapper = converter.objectMapper objectMapper.disable