diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 4043b614b7..f8007600ea 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -6208,13 +6208,21 @@ class annotated with `@SpringBootApplication` or `@SpringBootConfiguration`. As you <> in a sensible way, your main configuration is usually found. -NOTE: If you use a +[NOTE] +==== +If you use a <>, you should avoid adding configuration settings that are specific to a particular area on the <>. +The underlying component scan configuration of `@SpringBootApplication` defines exclude +filters that are used to make sure slicing works as expected. If you are using an explicit +`@ComponentScan` directive on your `@SpringBootApplication`-annoted class, be aware that +those filters will be disabled. If you are using slicing, you should define them again. +==== + If you want to customize the primary configuration, you can use a nested `@TestConfiguration` class. Unlike a nested `@Configuration` class, which would be used instead of your application's primary configuration, a nested `@TestConfiguration` class @@ -7721,6 +7729,41 @@ TIP: You should mark the dependencies to the library as optional so that you can the `autoconfigure` module in your projects more easily. If you do it that way, the library is not provided and, by default, Spring Boot backs off. +Spring Boot uses an annotation processor to collect the conditions on auto-configurations +in a metadata file (`META-INF/spring-autoconfigure-metadata.json`). If that file is +present, it is used to eagerly filter auto-configurations that do not match, which will +improve startup time. It is recommended to add the following dependency in a module that +contains auto-configurations: + +[source,xml,indent=0,subs="verbatim,quotes,attributes"] +---- + + org.springframework.boot + spring-boot-autoconfigure-processor + true + +---- + +With Gradle 4.5 and earlier, the dependency should be declared in the `compileOnly` +configuration, as shown in the following example: + +[source,groovy,indent=0,subs="verbatim,quotes,attributes"] +---- + dependencies { + compileOnly "org.springframework.boot:spring-boot-autoconfigure-processor" + } +---- + +With Gradle 4.6 and later, the dependency should be declared in the `annotationProcessor` +configuration, as shown in the following example: + +[source,groovy,indent=0,subs="verbatim,quotes,attributes"] +---- + dependencies { + annotationProcessor "org.springframework.boot:spring-boot-autoconfigure-processor" + } +---- + [[boot-features-custom-starter-module-starter]]