Commit 42c2059d authored by Stephane Nicoll's avatar Stephane Nicoll

Merge branch '2.0.x'

parents 0d63e7f5 f6c99361
...@@ -6208,13 +6208,21 @@ class annotated with `@SpringBootApplication` or `@SpringBootConfiguration`. As ...@@ -6208,13 +6208,21 @@ class annotated with `@SpringBootApplication` or `@SpringBootConfiguration`. As
you <<using-boot-structuring-your-code, structured your code>> in a sensible way, your you <<using-boot-structuring-your-code, structured your code>> in a sensible way, your
main configuration is usually found. main configuration is usually found.
NOTE: If you use a [NOTE]
====
If you use a
<<boot-features-testing-spring-boot-applications-testing-autoconfigured-tests, test <<boot-features-testing-spring-boot-applications-testing-autoconfigured-tests, test
annotation to test a more specific slice of your application>>, you should avoid adding annotation to test a more specific slice of your application>>, you should avoid adding
configuration settings that are specific to a particular area on the configuration settings that are specific to a particular area on the
<<boot-features-testing-spring-boot-applications-testing-user-configuration, main <<boot-features-testing-spring-boot-applications-testing-user-configuration, main
method's application class>>. method's application class>>.
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 If you want to customize the primary configuration, you can use a nested
`@TestConfiguration` class. Unlike a nested `@Configuration` class, which would be used `@TestConfiguration` class. Unlike a nested `@Configuration` class, which would be used
instead of your application's primary configuration, a nested `@TestConfiguration` class 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 ...@@ -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 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. 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"]
----
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure-processor</artifactId>
<optional>true</optional>
</dependency>
----
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]] [[boot-features-custom-starter-module-starter]]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment