spring-cloud-feign

Feign client and Spring retry

人走茶凉 提交于 2019-12-07 02:48:41
问题 I have a restful service calling an external service using Spring Cloud Feign client @FeignClient(name = "external-service", configuration = FeignClientConfig.class) public interface ServiceClient { @RequestMapping(value = "/test/payments", method = RequestMethod.POST) public void addPayment(@Valid @RequestBody AddPaymentRequest addPaymentRequest); @RequestMapping(value = "/test/payments/{paymentId}", method = RequestMethod.PUT) public ChangePaymentStatusResponse updatePaymentStatus(

How to generate spring cloud feign client using swagger-codegen-maven-plugin

 ̄綄美尐妖づ 提交于 2019-12-06 11:25:38
I want to generate my feign client code using swagger-codegen, but I cannot find the docs which can lead me to do it. I have a microservice using spring cloud, several api-services using spring-cloud-feign interfaces to request the data.I wish that i can generate the feign client code. <plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>2.2.3</version> <executions> <execution> <goals> <goal>generate</goal> </goals> <configuration> <inputSpec>http://localhost:9141/v2/api-docs?group=building-service-api</inputSpec> <language>java</language>

How to disable eureka lookup on specific @FeignClient

跟風遠走 提交于 2019-12-05 17:38:09
I have a microservice that uses @FeignClient predominantly to talk to other micro-services. This works beautifuly using Eureka's service discovery mechanism. Now I have a pressing need to use a @FeignClient to connect to an external system and still perform load balancing using configurations as shown below. Feign client : @FeignClient("externalServers") public interface ExternalServersClient { @RequestMapping(method = RequestMethod.GET, value = "/someExternalUrl") ResponseEntity<Object> callExternalServer(); } application.yml : externalServers: ribbon: listOfServers: server1:18201,server2

Feign client and Spring retry

[亡魂溺海] 提交于 2019-12-05 04:42:05
I have a restful service calling an external service using Spring Cloud Feign client @FeignClient(name = "external-service", configuration = FeignClientConfig.class) public interface ServiceClient { @RequestMapping(value = "/test/payments", method = RequestMethod.POST) public void addPayment(@Valid @RequestBody AddPaymentRequest addPaymentRequest); @RequestMapping(value = "/test/payments/{paymentId}", method = RequestMethod.PUT) public ChangePaymentStatusResponse updatePaymentStatus(@PathVariable("paymentId") String paymentId, @Valid @RequestBody PaymentStatusUpdateRequest

Spring Cloud | Feign Hytrix | First Call Timeout

穿精又带淫゛_ 提交于 2019-12-05 02:11:26
问题 I have a service that has uses 3 feign clients. Each time I start my application, I get a TimeoutException on the first call to any feign client. I have to trigger each feign client at least once before everything is stable. Looking around online, the problem is that something inside of feign or hystrix is lazy loaded and the solution was to make a configuration class that overrides the spring defaults. I've tried that wiith the below code and it is still not helping. I still see the same

Spring Cloud discovery for multiple service versions

隐身守侯 提交于 2019-12-05 01:58:00
问题 I'm asking myself a question without finding responses for it. Maybe someone here would have ideas about that ;-) Using a services registry (Eureka) in Spring Cloud with RestTemplate and Feign clients, I have different build versions of the same service. The build version being documented through Actuator's /info endpoint. { "build": { "version": "0.0.1-SNAPSHOT", "artifact": "service-a", "name": "service-a", "group": "com.mycompany", "time": 1487253409000 } } ... { "build": { "version": "0.0

Spring Data Pageable not supported as RequestParam in Feign Client

情到浓时终转凉″ 提交于 2019-12-04 20:04:31
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 = RequestMethod.GET, value = "data") public Page<Data> getData(@RequestParam(name = "pageable",

FeignClient in spring boot 2

僤鯓⒐⒋嵵緔 提交于 2019-12-04 19:34:52
问题 I am trying to migrate from spring boot 1.5 tio 2.0 and faced problem: I changed version of spring-cloud-netflix-core from 1.3.4.RELEASE to 2.0.1.RELEASE : <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-netflix-core</artifactId> <version>2.0.1.RELEASE</version> </dependency> Unfortunately, feign library imports failed: import org.springframework.cloud.netflix.feign.EnableFeignClients; import org.springframework.cloud.netflix.feign.FeignAutoConfiguration;

Spring @FeignClient , OAuth2 and @Scheduled not working

旧街凉风 提交于 2019-12-04 16:52:21
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 request attributes outside of an actual web request, or processing a request outside of the originally

Spring Cloud: Feign and Http Connection Pooling

喜欢而已 提交于 2019-12-04 13:27:40
问题 Can anyone please tell me if the Spring Cloud Feign Client provides or supports Http Connection Pooling, and if so how to configure settings like pool size? I can't seem to find this in the official documentation. Thank you. 回答1: From investigation I will try to answer my own question: Spring Cloud Feign uses Netflix Feign. Netflix Feign in turn creates connections using java.net.HttpURLConnection which makes use of 'persistent connections' but not a connection pool. It is possible to