mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Document use of component scan exclude filters on SpringBootApplication
Closes gh-10933
This commit is contained in:
parent
d0b71a7d43
commit
584d2de9f3
@ -5421,13 +5421,21 @@ 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
|
||||
[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, you should
|
||||
avoid adding configuration that are specific to a particular area on the
|
||||
<<boot-features-testing-spring-boot-applications-testing-user-configuration, main'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
|
||||
`@TestConfiguration` class. Unlike a nested `@Configuration` class which would be used
|
||||
instead of a your application's primary configuration, a nested `@TestConfiguration` class
|
||||
|
Loading…
Reference in New Issue
Block a user