Added documentation on the Infrastructure bean role; fixes gh-1022

This commit is contained in:
Marcin Grzejszczak
2018-12-19 19:05:26 +01:00
parent 17d8165c5e
commit a4138e2167
2 changed files with 9 additions and 0 deletions

View File

@@ -1307,6 +1307,10 @@ The following example shows how to set up such a custom `Executor`:
include::../../../../spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/MultipleAsyncRestTemplateTests.java[tags=custom_executor,indent=0]
----
TIP: To ensure that your configuration gets post processed, remember
to add the `@Role(BeanDefinition.ROLE_INFRASTRUCTURE)` on your
`@Configuration` class
=== Messaging
Features from this section can be disabled by setting the `spring.sleuth.messaging.enabled` property with value equal to `false`.

View File

@@ -31,15 +31,18 @@ import org.awaitility.Awaitility;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cloud.sleuth.instrument.async.LazyTraceExecutor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Role;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.AsyncClientHttpRequest;
@@ -180,6 +183,8 @@ public class MultipleAsyncRestTemplateTests {
@Configuration
@EnableAutoConfiguration
@EnableAsync
// add the infrastructure role to ensure that the bean gets auto-proxied
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
static class CustomExecutorConfig extends AsyncConfigurerSupport {
@Autowired