Document how to structure configurations for efficient slice tests

Closes gh-16088
This commit is contained in:
Madhura Bhave
2022-03-07 18:11:17 -08:00
parent 4bcb7e2f77
commit ed8f8d59ef
5 changed files with 145 additions and 0 deletions

View File

@@ -845,6 +845,7 @@ include::{docs-java}/features/testing/springbootapplications/userconfigurationan
NOTE: Depending on the complexity of your application, you may either have a single `@Configuration` class for your customizations or one class per domain area.
The latter approach lets you enable it in one of your tests, if necessary, with the `@Import` annotation.
See <<howto#howto.testing.slice-tests,this how-to section>> for more details on when you might want to enable specific `@Configuration` classes for slice tests.
Test slices exclude `@Configuration` classes from scanning.
For example, for a `@WebMvcTest`, the following configuration will not include the given `WebMvcConfigurer` bean in the application context loaded by the test slice: