Document effect of user configuration on slicing

Closes gh-10709
This commit is contained in:
Stephane Nicoll 2017-10-20 08:41:47 +02:00
parent 53335c069c
commit 42fe8c1f38

View File

@ -5398,6 +5398,12 @@ The search algorithm works up from the package that contains the test until it f
<<using-boot-structuring-your-code, structured your code>> in a sensible way your main
configuration is usually found.
NOTE: If you use a <<boot-features-testing-spring-boot-applications-testing-autoconfigured-tests,
test annotation to test a more specific slice of your application>> with such setup, any
user configuration defined on your `@SpringBootApplication` will be processed. This can
break the purpose of slicing and it is recommended to move such configuration to a
`@Configuration` class alongside your `@SpringBootApplication`.
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 a your application's primary configuration, a nested `@TestConfiguration` class