Fix component scan test setup

This commit fixes the setup of tests using component scan. Previously,
a configuration used an include filter to only include a particular
configuration class in a given package. Unfortunately, include filters
do not prevent regular filters by default and the definition did not
have the intended behaviour.

This commit disables default filters so that only the specified include
filter is applied.
This commit is contained in:
Stephane Nicoll 2019-12-30 14:51:51 +01:00
parent 3c8b3fba9f
commit cf740add85
1 changed files with 2 additions and 2 deletions

View File

@ -380,7 +380,7 @@ public class ConditionalOnMissingBeanTests {
}
@Configuration(proxyBeanMethods = false)
@ComponentScan(basePackages = "org.springframework.boot.autoconfigure.condition.scan",
@ComponentScan(basePackages = "org.springframework.boot.autoconfigure.condition.scan", useDefaultFilters = false,
includeFilters = @Filter(type = FilterType.ASSIGNABLE_TYPE,
classes = ScannedFactoryBeanConfiguration.class))
static class ComponentScannedFactoryBeanBeanMethodConfiguration {
@ -388,7 +388,7 @@ public class ConditionalOnMissingBeanTests {
}
@Configuration(proxyBeanMethods = false)
@ComponentScan(basePackages = "org.springframework.boot.autoconfigure.condition.scan",
@ComponentScan(basePackages = "org.springframework.boot.autoconfigure.condition.scan", useDefaultFilters = false,
includeFilters = @Filter(type = FilterType.ASSIGNABLE_TYPE,
classes = ScannedFactoryBeanWithBeanMethodArgumentsConfiguration.class))
static class ComponentScannedFactoryBeanBeanMethodWithArgumentsConfiguration {