Skip to content

Commit 584d2de

Browse files
committed
Document use of component scan exclude filters on SpringBootApplication
Closes gh-10933
1 parent d0b71a7 commit 584d2de

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

+9-1
Original file line numberDiff line numberDiff line change
@@ -5421,13 +5421,21 @@ The search algorithm works up from the package that contains the test until it f
54215421
<<using-boot-structuring-your-code, structured your code>> in a sensible way your main
54225422
configuration is usually found.
54235423

5424-
NOTE: If you use a
5424+
[NOTE]
5425+
====
5426+
If you use a
54255427
<<boot-features-testing-spring-boot-applications-testing-autoconfigured-tests, test
54265428
annotation to test a more specific slice of your application>> with such setup, you should
54275429
avoid adding configuration that are specific to a particular area on the
54285430
<<boot-features-testing-spring-boot-applications-testing-user-configuration, main's
54295431
application class>>.
54305432
5433+
The underlying component scan configuration of `@SpringBootApplication` defines exclude
5434+
filters that are used to make sure slicing works as expected. If you are using an explicit
5435+
`@ComponentScan` directive on your `@SpringBootApplication`-annoted class, be aware that
5436+
those filters will be disabled. If you are using slicing, you should define them again.
5437+
====
5438+
54315439
If you want to customize the primary configuration, you can use a nested
54325440
`@TestConfiguration` class. Unlike a nested `@Configuration` class which would be used
54335441
instead of a your application's primary configuration, a nested `@TestConfiguration` class

0 commit comments

Comments
 (0)