From b2fd4339b74e0ea25d3d58a9a66a22f4483684ea Mon Sep 17 00:00:00 2001 From: buildmaster Date: Tue, 10 Sep 2019 13:30:21 +0000 Subject: [PATCH] Sync docs from master to gh-pages --- reference/html/README.html | 66 +++++------ reference/html/index.html | 123 +++++++++++---------- reference/html/spring-cloud-openfeign.html | 123 +++++++++++---------- 3 files changed, 165 insertions(+), 147 deletions(-) diff --git a/reference/html/README.html b/reference/html/README.html index b70d217d..9d422f12 100644 --- a/reference/html/README.html +++ b/reference/html/README.html @@ -95,21 +95,21 @@ $(addBlockSwitches);
Table of Contents
@@ -134,7 +134,7 @@ and binding to the Spring Environment and other Spring programming model idioms.
-

Features

+

1. Features

    @@ -146,10 +146,10 @@ and binding to the Spring Environment and other Spring programming model idioms.
-

Building

+

2. Building

-

Basic Compile and Test

+

2.1. Basic Compile and Test

To build the source you will need to install JDK 1.8.

@@ -227,7 +227,7 @@ If all else fails, build with the command from .travis.yml (usually
-

Documentation

+

2.2. Documentation

The spring-cloud-build module has a "docs" profile, and if you switch that on it will try to build asciidoc sources from @@ -240,7 +240,7 @@ a modified file in the correct place. Just commit it and push the change.

-

Working with the code

+

2.3. Working with the code

If you don’t have an IDE preference we would recommend that you use Spring Tools Suite or @@ -249,7 +249,7 @@ a modified file in the correct place. Just commit it and push the change.

should also work without issue as long as they use Maven 3.3.3 or better.

-

Importing into eclipse with m2eclipse

+

2.3.1. Importing into eclipse with m2eclipse

We recommend the m2eclipse eclipse plugin when working with eclipse. If you don’t already have m2eclipse installed it is available from the "eclipse @@ -276,7 +276,7 @@ pom into your settings.xml.

-

Importing into eclipse without m2eclipse

+

2.3.2. Importing into eclipse without m2eclipse

If you prefer not to use m2eclipse you can generate eclipse project metadata using the following command:

@@ -295,7 +295,7 @@ from the file menu.

-

Contributing

+

3. Contributing

Spring Cloud is released under the non-restrictive Apache 2.0 license, @@ -305,7 +305,7 @@ to contribute even something trivial please do not hesitate, but follow the guidelines below.

-

Sign the Contributor License Agreement

+

3.1. Sign the Contributor License Agreement

Before we accept a non-trivial patch or pull request we will need you to sign the Contributor License Agreement. @@ -316,7 +316,7 @@ given the ability to merge pull requests.

-

Code of Conduct

+

3.2. Code of Conduct

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report @@ -324,7 +324,7 @@ unacceptable behavior to spri

-

Code Conventions and Housekeeping

+

3.3. Code Conventions and Housekeeping

None of these is essential for a pull request, but they will all help. They can also be added after the original pull request but before a merge.

@@ -372,7 +372,7 @@ message (where XXXX is the issue number).

-

Checkstyle

+

3.4. Checkstyle

Spring Cloud Build comes with a set of checkstyle rules. You can find them in the spring-cloud-build-tools module. The most notable files under the module are:

@@ -405,7 +405,7 @@ message (where XXXX is the issue number).

-

Checkstyle configuration

+

3.4.1. Checkstyle configuration

Checkstyle rules are disabled by default. To add checkstyle to your project just define the following properties and plugins.

@@ -475,11 +475,11 @@ message (where XXXX is the issue number).

<?xml version="1.0"?>
 <!DOCTYPE suppressions PUBLIC
-		"-//Puppy Crawl//DTD Suppressions 1.1//EN"
-		"https://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
+        "-//Puppy Crawl//DTD Suppressions 1.1//EN"
+        "https://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
 <suppressions>
-	<suppress files=".*ConfigServerApplication\.java" checks="HideUtilityClassConstructor"/>
-	<suppress files=".*ConfigClientWatch\.java" checks="LineLengthCheck"/>
+    <suppress files=".*ConfigServerApplication\.java" checks="HideUtilityClassConstructor"/>
+    <suppress files=".*ConfigClientWatch\.java" checks="LineLengthCheck"/>
 </suppressions>
@@ -495,9 +495,9 @@ $ touch .springformat
-

IDE setup

+

3.5. IDE setup

-

Intellij IDEA

+

3.5.1. Intellij IDEA

In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin. The following files can be found in the Spring Cloud Build project.

@@ -569,15 +569,15 @@ The following files can be found in the -

Go to FileSettingsOther settingsCheckstyle. There click on the + icon in the Configuration file section. There, you’ll have to define where the checkstyle rules should be picked from. In the image above, we’ve picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build’s GitHub repository (e.g. for the checkstyle.xml : https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml). We need to provide the following variables:

+

Go to FileSettingsOther settingsCheckstyle. There click on the + icon in the Configuration file section. There, you’ll have to define where the checkstyle rules should be picked from. In the image above, we’ve picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build’s GitHub repository (e.g. for the checkstyle.xml : raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml). We need to provide the following variables:

@@ -127,13 +128,13 @@ and binding to the Spring Environment and other Spring programming model idioms.
-

Declarative REST Client: Feign

+

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.

-

How to Include 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 @@ -188,7 +189,7 @@ in your external configuration (see

-

Overriding Feign Defaults

+

1.2. Overriding Feign Defaults

A central concept in Spring Cloud’s Feign support is that of the named client. Each feign client is part of an ensemble of components that work together to contact a remote server on demand, and the ensemble has a name that you give it as an application developer using the @FeignClient annotation. Spring Cloud creates a new ensemble as an ApplicationContext on demand for each named client using FeignClientsConfiguration. This contains (amongst other things) an feign.Decoder, a feign.Encoder, and a feign.Contract. @@ -456,7 +457,7 @@ public interface BarClient {

-

Creating Feign Clients Manually

+

1.3. Creating Feign Clients Manually

In some cases it might be necessary to customize your Feign Clients in a way that is not possible using the methods above. In this case you can create Clients using the @@ -469,25 +470,25 @@ a separate request interceptor.

@Import(FeignClientsConfiguration.class)
 class FooController {
 
-	private FooClient fooClient;
+    private FooClient fooClient;
 
-	private FooClient adminClient;
+    private FooClient adminClient;
 
-    	@Autowired
-	public FooController(Decoder decoder, Encoder encoder, Client client, Contract contract) {
-		this.fooClient = Feign.builder().client(client)
-				.encoder(encoder)
-				.decoder(decoder)
-				.contract(contract)
-				.requestInterceptor(new BasicAuthRequestInterceptor("user", "user"))
-				.target(FooClient.class, "https://PROD-SVC");
+        @Autowired
+    public FooController(Decoder decoder, Encoder encoder, Client client, Contract contract) {
+        this.fooClient = Feign.builder().client(client)
+                .encoder(encoder)
+                .decoder(decoder)
+                .contract(contract)
+                .requestInterceptor(new BasicAuthRequestInterceptor("user", "user"))
+                .target(FooClient.class, "https://PROD-SVC");
 
-		this.adminClient = Feign.builder().client(client)
-				.encoder(encoder)
-				.decoder(decoder)
-				.contract(contract)
-				.requestInterceptor(new BasicAuthRequestInterceptor("admin", "admin"))
-				.target(FooClient.class, "https://PROD-SVC");
+        this.adminClient = Feign.builder().client(client)
+                .encoder(encoder)
+                .decoder(decoder)
+                .contract(contract)
+                .requestInterceptor(new BasicAuthRequestInterceptor("admin", "admin"))
+                .target(FooClient.class, "https://PROD-SVC");
     }
 }
@@ -533,7 +534,7 @@ the default Feign native annotations.
-

Feign Hystrix Support

+

1.4. Feign Hystrix Support

If Hystrix is on the classpath and feign.hystrix.enabled=true, Feign will wrap all methods with a circuit breaker. Returning a com.netflix.hystrix.HystrixCommand is also available. This lets you use reactive patterns (with a call to .toObservable() or .observe() or asynchronous use (with a call to .queue()).

@@ -544,11 +545,11 @@ the default Feign native annotations.
@Configuration
 public class FooConfiguration {
-    	@Bean
-	@Scope("prototype")
-	public Feign.Builder feignBuilder() {
-		return Feign.builder();
-	}
+        @Bean
+    @Scope("prototype")
+    public Feign.Builder feignBuilder() {
+        return Feign.builder();
+    }
 }
@@ -568,7 +569,7 @@ favor for an opt-in approach.
-

Feign Hystrix Fallbacks

+

1.5. Feign Hystrix Fallbacks

Hystrix supports the notion of a fallback: a default code path that is executed when they circuit is open or there is an error. To enable fallbacks for a given @FeignClient set the fallback attribute to the class name that implements the fallback. You also need to declare your implementation as a Spring bean.

@@ -595,21 +596,21 @@ static class HystrixClientFallback implements HystrixClient {
@FeignClient(name = "hello", fallbackFactory = HystrixClientFallbackFactory.class)
 protected interface HystrixClient {
-	@RequestMapping(method = RequestMethod.GET, value = "/hello")
-	Hello iFailSometimes();
+    @RequestMapping(method = RequestMethod.GET, value = "/hello")
+    Hello iFailSometimes();
 }
 
 @Component
 static class HystrixClientFallbackFactory implements FallbackFactory<HystrixClient> {
-	@Override
-	public HystrixClient create(Throwable cause) {
-		return new HystrixClient() {
-			@Override
-			public Hello iFailSometimes() {
-				return new Hello("fallback; reason was: " + cause.getMessage());
-			}
-		};
-	}
+    @Override
+    public HystrixClient create(Throwable cause) {
+        return new HystrixClient() {
+            @Override
+            public Hello iFailSometimes() {
+                return new Hello("fallback; reason was: " + cause.getMessage());
+            }
+        };
+    }
 }
@@ -627,7 +628,7 @@ There is a limitation with the implementation of fallbacks in Feign and how Hyst
-

Feign and @Primary

+

1.6. Feign and @Primary

When using Feign with Hystrix fallbacks, there are multiple beans in the ApplicationContext of the same type. This will cause @Autowired to not work because there isn’t exactly one bean, or one marked as primary. To work around this, Spring Cloud Netflix marks all Feign instances as @Primary, so Spring Framework will know which bean to inject. In some cases, this may not be desirable. To turn off this behavior set the primary attribute of @FeignClient to false.

@@ -635,13 +636,13 @@ There is a limitation with the implementation of fallbacks in Feign and how Hyst
@FeignClient(name = "hello", primary = false)
 public interface HelloClient {
-	// methods here
+    // methods here
 }
-

Feign Inheritance Support

+

1.7. Feign Inheritance Support

Feign supports boilerplate apis via single-inheritance interfaces. This allows grouping common operations into convenient base interfaces.

@@ -693,7 +694,7 @@ mapping is not inherited).
-

Feign request/response compression

+

1.8. Feign request/response compression

You may consider enabling the request or response GZIP compression for your Feign requests. You can do this by enabling one of the properties:

@@ -719,7 +720,7 @@ feign.compression.request.min-request-size=2048
-

Feign logging

+

1.9. Feign logging

A logger is created for each Feign client created. By default the name of the logger is the full class name of the interface used to create the Feign client. Feign logging only responds to the DEBUG level.

@@ -764,7 +765,7 @@ public class FooConfiguration {
-

Feign @QueryMap support

+

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 @@ -806,7 +807,7 @@ public interface DemoTemplate {

-

HATEOAS support

+

1.11. HATEOAS support

Spring provides some APIs to create REST representations that follow the HATEOAS principle, Spring Hateoas and Spring Data REST.

@@ -831,6 +832,14 @@ public interface DemoTemplate {
+
+

2. Configuration properties

+
+
+

To see the list of all Sleuth related configuration properties please check the Appendix page.

+
+
+
diff --git a/reference/html/spring-cloud-openfeign.html b/reference/html/spring-cloud-openfeign.html index e3f98481..1dcd2e2a 100644 --- a/reference/html/spring-cloud-openfeign.html +++ b/reference/html/spring-cloud-openfeign.html @@ -96,21 +96,22 @@ $(addBlockSwitches);
Table of Contents
@@ -127,13 +128,13 @@ and binding to the Spring Environment and other Spring programming model idioms.
-

Declarative REST Client: Feign

+

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.

-

How to Include 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 @@ -188,7 +189,7 @@ in your external configuration (see

-

Overriding Feign Defaults

+

1.2. Overriding Feign Defaults

A central concept in Spring Cloud’s Feign support is that of the named client. Each feign client is part of an ensemble of components that work together to contact a remote server on demand, and the ensemble has a name that you give it as an application developer using the @FeignClient annotation. Spring Cloud creates a new ensemble as an ApplicationContext on demand for each named client using FeignClientsConfiguration. This contains (amongst other things) an feign.Decoder, a feign.Encoder, and a feign.Contract. @@ -456,7 +457,7 @@ public interface BarClient {

-

Creating Feign Clients Manually

+

1.3. Creating Feign Clients Manually

In some cases it might be necessary to customize your Feign Clients in a way that is not possible using the methods above. In this case you can create Clients using the @@ -469,25 +470,25 @@ a separate request interceptor.

@Import(FeignClientsConfiguration.class)
 class FooController {
 
-	private FooClient fooClient;
+    private FooClient fooClient;
 
-	private FooClient adminClient;
+    private FooClient adminClient;
 
-    	@Autowired
-	public FooController(Decoder decoder, Encoder encoder, Client client, Contract contract) {
-		this.fooClient = Feign.builder().client(client)
-				.encoder(encoder)
-				.decoder(decoder)
-				.contract(contract)
-				.requestInterceptor(new BasicAuthRequestInterceptor("user", "user"))
-				.target(FooClient.class, "https://PROD-SVC");
+        @Autowired
+    public FooController(Decoder decoder, Encoder encoder, Client client, Contract contract) {
+        this.fooClient = Feign.builder().client(client)
+                .encoder(encoder)
+                .decoder(decoder)
+                .contract(contract)
+                .requestInterceptor(new BasicAuthRequestInterceptor("user", "user"))
+                .target(FooClient.class, "https://PROD-SVC");
 
-		this.adminClient = Feign.builder().client(client)
-				.encoder(encoder)
-				.decoder(decoder)
-				.contract(contract)
-				.requestInterceptor(new BasicAuthRequestInterceptor("admin", "admin"))
-				.target(FooClient.class, "https://PROD-SVC");
+        this.adminClient = Feign.builder().client(client)
+                .encoder(encoder)
+                .decoder(decoder)
+                .contract(contract)
+                .requestInterceptor(new BasicAuthRequestInterceptor("admin", "admin"))
+                .target(FooClient.class, "https://PROD-SVC");
     }
 }
@@ -533,7 +534,7 @@ the default Feign native annotations.
-

Feign Hystrix Support

+

1.4. Feign Hystrix Support

If Hystrix is on the classpath and feign.hystrix.enabled=true, Feign will wrap all methods with a circuit breaker. Returning a com.netflix.hystrix.HystrixCommand is also available. This lets you use reactive patterns (with a call to .toObservable() or .observe() or asynchronous use (with a call to .queue()).

@@ -544,11 +545,11 @@ the default Feign native annotations.
@Configuration
 public class FooConfiguration {
-    	@Bean
-	@Scope("prototype")
-	public Feign.Builder feignBuilder() {
-		return Feign.builder();
-	}
+        @Bean
+    @Scope("prototype")
+    public Feign.Builder feignBuilder() {
+        return Feign.builder();
+    }
 }
@@ -568,7 +569,7 @@ favor for an opt-in approach.
-

Feign Hystrix Fallbacks

+

1.5. Feign Hystrix Fallbacks

Hystrix supports the notion of a fallback: a default code path that is executed when they circuit is open or there is an error. To enable fallbacks for a given @FeignClient set the fallback attribute to the class name that implements the fallback. You also need to declare your implementation as a Spring bean.

@@ -595,21 +596,21 @@ static class HystrixClientFallback implements HystrixClient {
@FeignClient(name = "hello", fallbackFactory = HystrixClientFallbackFactory.class)
 protected interface HystrixClient {
-	@RequestMapping(method = RequestMethod.GET, value = "/hello")
-	Hello iFailSometimes();
+    @RequestMapping(method = RequestMethod.GET, value = "/hello")
+    Hello iFailSometimes();
 }
 
 @Component
 static class HystrixClientFallbackFactory implements FallbackFactory<HystrixClient> {
-	@Override
-	public HystrixClient create(Throwable cause) {
-		return new HystrixClient() {
-			@Override
-			public Hello iFailSometimes() {
-				return new Hello("fallback; reason was: " + cause.getMessage());
-			}
-		};
-	}
+    @Override
+    public HystrixClient create(Throwable cause) {
+        return new HystrixClient() {
+            @Override
+            public Hello iFailSometimes() {
+                return new Hello("fallback; reason was: " + cause.getMessage());
+            }
+        };
+    }
 }
@@ -627,7 +628,7 @@ There is a limitation with the implementation of fallbacks in Feign and how Hyst
-

Feign and @Primary

+

1.6. Feign and @Primary

When using Feign with Hystrix fallbacks, there are multiple beans in the ApplicationContext of the same type. This will cause @Autowired to not work because there isn’t exactly one bean, or one marked as primary. To work around this, Spring Cloud Netflix marks all Feign instances as @Primary, so Spring Framework will know which bean to inject. In some cases, this may not be desirable. To turn off this behavior set the primary attribute of @FeignClient to false.

@@ -635,13 +636,13 @@ There is a limitation with the implementation of fallbacks in Feign and how Hyst
@FeignClient(name = "hello", primary = false)
 public interface HelloClient {
-	// methods here
+    // methods here
 }
-

Feign Inheritance Support

+

1.7. Feign Inheritance Support

Feign supports boilerplate apis via single-inheritance interfaces. This allows grouping common operations into convenient base interfaces.

@@ -693,7 +694,7 @@ mapping is not inherited).
-

Feign request/response compression

+

1.8. Feign request/response compression

You may consider enabling the request or response GZIP compression for your Feign requests. You can do this by enabling one of the properties:

@@ -719,7 +720,7 @@ feign.compression.request.min-request-size=2048
-

Feign logging

+

1.9. Feign logging

A logger is created for each Feign client created. By default the name of the logger is the full class name of the interface used to create the Feign client. Feign logging only responds to the DEBUG level.

@@ -764,7 +765,7 @@ public class FooConfiguration {
-

Feign @QueryMap support

+

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 @@ -806,7 +807,7 @@ public interface DemoTemplate {

-

HATEOAS support

+

1.11. HATEOAS support

Spring provides some APIs to create REST representations that follow the HATEOAS principle, Spring Hateoas and Spring Data REST.

@@ -831,6 +832,14 @@ public interface DemoTemplate {
+
+

2. Configuration properties

+
+
+

To see the list of all Sleuth related configuration properties please check the Appendix page.

+
+
+