diff --git a/multi/multi_spring-cloud-feign.html b/multi/multi_spring-cloud-feign.html index 5289f5a4..fa5d290c 100644 --- a/multi/multi_spring-cloud-feign.html +++ b/multi/multi_spring-cloud-feign.html @@ -189,25 +189,25 @@ feign.compression.request.min-request-size=2048return Logger.Level.FULL; } -}
        OtherClass.someMethod(myprop.get());
-    }
 }
-stripped). The proxy uses Ribbon to locate an instance to forward to
-via discovery, and all requests are executed in a
-<<hystrix-fallbacks-for-routes, hystrix command>>, so
-failures will show up in Hystrix metrics, and once the circuit is open
-the proxy will not try to contact the service.

1.10 Feign @QueryMap support

The OpenFeign @QueryMap annotation provides support for POJOs to be used as -GET parameter maps. Unfortunately, the default OpenFeign QueryMap annotation is -incompatible with Spring because it lacks a value property.

Spring Cloud OpenFeign provides an equivalent @SpringQueryMap annotation, which -is used to annotate a POJO or Map parameter as a query parameter map.

For example, the Params class defines parameters param1 and param2:

// Params.java
-public class Params {
-    private String param1;
-    private String param2;
 
-    // [Getters and setters omitted for brevity]
-}

The following feign client uses the Params class by using the @SpringQueryMap annotation:

@FeignClient("demo")
-public class DemoTemplate {
+=== Feign `@QueryMap` support
 
-    @GetMapping(path = "/demo")
-    String demoEndpoint(@SpringQueryMap Params params);
-}
\ No newline at end of file +The OpenFeign `@QueryMap` annotation provides support for POJOs to be used as +GET parameter maps. Unfortunately, the default OpenFeign QueryMap annotation is +incompatible with Spring because it lacks a `value` property. + +Spring Cloud OpenFeign provides an equivalent `@SpringQueryMap` annotation, which +is used to annotate a POJO or Map parameter as a query parameter map. + +For example, the `Params` class defines parameters `param1` and `param2`: + +[source,java,indent=0]

public class Params { + private String param1; + private String param2;

    // [Getters and setters omitted for brevity]
+}
The following feign client uses the `Params` class by using the `@SpringQueryMap` annotation:
+
+[source,java,indent=0]

@FeignClient("demo") +public class DemoTemplate {

    @GetMapping(path = "/demo")
+    String demoEndpoint(@SpringQueryMap Params params);
+}

\ No newline at end of file
diff --git a/multi/multi_spring-cloud-openfeign.html b/multi/multi_spring-cloud-openfeign.html
index 0bf00c7e..ce08a84c 100644
--- a/multi/multi_spring-cloud-openfeign.html
+++ b/multi/multi_spring-cloud-openfeign.html
@@ -1,3 +1,3 @@
 
       
-   Spring Cloud OpenFeign

Spring Cloud OpenFeign


Table of Contents

1. Declarative REST Client: Feign
1.1. How to Include Feign
1.2. Overriding Feign Defaults
1.3. Creating Feign Clients Manually
1.4. Feign Hystrix Support
1.5. Feign Hystrix Fallbacks
1.6. Feign and @Primary
1.7. Feign Inheritance Support
1.8. Feign request/response compression
1.9. Feign logging
1.10. Feign @QueryMap support
\ No newline at end of file + Spring Cloud OpenFeign

Spring Cloud OpenFeign


Table of Contents

1. Declarative REST Client: Feign
1.1. How to Include Feign
1.2. Overriding Feign Defaults
1.3. Creating Feign Clients Manually
1.4. Feign Hystrix Support
1.5. Feign Hystrix Fallbacks
1.6. Feign and @Primary
1.7. Feign Inheritance Support
1.8. Feign request/response compression
1.9. Feign logging
\ No newline at end of file diff --git a/single/spring-cloud-openfeign.html b/single/spring-cloud-openfeign.html index 1236cbaf..8d423e43 100644 --- a/single/spring-cloud-openfeign.html +++ b/single/spring-cloud-openfeign.html @@ -1,6 +1,6 @@ - Spring Cloud OpenFeign

Spring Cloud OpenFeign


Table of Contents

1. Declarative REST Client: Feign
1.1. How to Include Feign
1.2. Overriding Feign Defaults
1.3. Creating Feign Clients Manually
1.4. Feign Hystrix Support
1.5. Feign Hystrix Fallbacks
1.6. Feign and @Primary
1.7. Feign Inheritance Support
1.8. Feign request/response compression
1.9. Feign logging
1.10. Feign @QueryMap support

2.1.0.BUILD-SNAPSHOT

This project provides OpenFeign integrations for Spring Boot apps through autoconfiguration + Spring Cloud OpenFeign

Spring Cloud OpenFeign


2.1.0.BUILD-SNAPSHOT

This project provides OpenFeign integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms.

1. Declarative REST Client: Feign

Feign is a declarative web service client. It makes writing web service clients easier. To use Feign create an interface and annotate it. It has pluggable annotation support including Feign annotations and JAX-RS annotations. Feign also supports pluggable encoders and decoders. Spring Cloud adds support for Spring MVC annotations and for using the same HttpMessageConverters used by default in Spring Web. Spring Cloud integrates Ribbon and Eureka to provide a load balanced http client when using Feign.

1.1 How to Include Feign

To include Feign in your project use the starter with group org.springframework.cloud and artifact id spring-cloud-starter-openfeign. See the Spring Cloud Project page for details on setting up your build system with the current Spring Cloud Release Train.

Example spring boot app

@SpringBootApplication
@@ -190,25 +190,25 @@ feign.compression.request.min-request-size=2048return Logger.Level.FULL;
     }
-}
        OtherClass.someMethod(myprop.get());
-    }
 }
-stripped). The proxy uses Ribbon to locate an instance to forward to
-via discovery, and all requests are executed in a
-<<hystrix-fallbacks-for-routes, hystrix command>>, so
-failures will show up in Hystrix metrics, and once the circuit is open
-the proxy will not try to contact the service.

1.10 Feign @QueryMap support

The OpenFeign @QueryMap annotation provides support for POJOs to be used as -GET parameter maps. Unfortunately, the default OpenFeign QueryMap annotation is -incompatible with Spring because it lacks a value property.

Spring Cloud OpenFeign provides an equivalent @SpringQueryMap annotation, which -is used to annotate a POJO or Map parameter as a query parameter map.

For example, the Params class defines parameters param1 and param2:

// Params.java
-public class Params {
-    private String param1;
-    private String param2;
 
-    // [Getters and setters omitted for brevity]
-}

The following feign client uses the Params class by using the @SpringQueryMap annotation:

@FeignClient("demo")
-public class DemoTemplate {
+=== Feign `@QueryMap` support
 
-    @GetMapping(path = "/demo")
-    String demoEndpoint(@SpringQueryMap Params params);
-}
\ No newline at end of file +The OpenFeign `@QueryMap` annotation provides support for POJOs to be used as +GET parameter maps. Unfortunately, the default OpenFeign QueryMap annotation is +incompatible with Spring because it lacks a `value` property. + +Spring Cloud OpenFeign provides an equivalent `@SpringQueryMap` annotation, which +is used to annotate a POJO or Map parameter as a query parameter map. + +For example, the `Params` class defines parameters `param1` and `param2`: + +[source,java,indent=0]

public class Params { + private String param1; + private String param2;

    // [Getters and setters omitted for brevity]
+}
The following feign client uses the `Params` class by using the `@SpringQueryMap` annotation:
+
+[source,java,indent=0]

@FeignClient("demo") +public class DemoTemplate {

    @GetMapping(path = "/demo")
+    String demoEndpoint(@SpringQueryMap Params params);
+}
\ No newline at end of file diff --git a/spring-cloud-openfeign.xml b/spring-cloud-openfeign.xml index d1708137..8eb56090 100644 --- a/spring-cloud-openfeign.xml +++ b/spring-cloud-openfeign.xml @@ -381,38 +381,34 @@ public class FooConfiguration { Logger.Level feignLoggerLevel() { return Logger.Level.FULL; } -} - OtherClass.someMethod(myprop.get()); - } } -stripped). The proxy uses Ribbon to locate an instance to forward to -via discovery, and all requests are executed in a -<<hystrix-fallbacks-for-routes, hystrix command>>, so -failures will show up in Hystrix metrics, and once the circuit is open -the proxy will not try to contact the service. - -
-Feign <literal>@QueryMap</literal> support -The OpenFeign @QueryMap annotation provides support for POJOs to be used as + +=== Feign `@QueryMap` support + +The OpenFeign `@QueryMap` annotation provides support for POJOs to be used as GET parameter maps. Unfortunately, the default OpenFeign QueryMap annotation is -incompatible with Spring because it lacks a value property. -Spring Cloud OpenFeign provides an equivalent @SpringQueryMap annotation, which -is used to annotate a POJO or Map parameter as a query parameter map. -For example, the Params class defines parameters param1 and param2: -// Params.java -public class Params { +incompatible with Spring because it lacks a `value` property. + +Spring Cloud OpenFeign provides an equivalent `@SpringQueryMap` annotation, which +is used to annotate a POJO or Map parameter as a query parameter map. + +For example, the `Params` class defines parameters `param1` and `param2`: + +[source,java,indent=0] +public class Params { private String param1; - private String param2; + private String param2; + // [Getters and setters omitted for brevity] +} +The following feign client uses the `Params` class by using the `@SpringQueryMap` annotation: - // [Getters and setters omitted for brevity] -} -The following feign client uses the Params class by using the @SpringQueryMap annotation: -@FeignClient("demo") -public class DemoTemplate { - - @GetMapping(path = "/demo") +[source,java,indent=0] +@FeignClient("demo") +public class DemoTemplate { + @GetMapping(path = "/demo") String demoEndpoint(@SpringQueryMap Params params); -} +} +
\ No newline at end of file