Document usage of auto-configuration AP for 3rd party starters

Closes gh-13368
This commit is contained in:
Stephane Nicoll 2018-06-06 10:37:57 +02:00
parent 6c7289b822
commit d0b71a7d43

View File

@ -6490,6 +6490,30 @@ 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
won't be provided and Spring Boot will back off by default.
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"]
----
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure-processor</artifactId>
<optional>true</optional>
</dependency>
----
With Gradle you would add:
[source,groovy,indent=0,subs="verbatim,quotes,attributes"]
----
dependencies {
compileOnly "org.springframework.boot:spring-boot-autoconfigure-processor"
}
----
[[boot-features-custom-starter-module-starter]]