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.
pull/19492/head
Stephane Nicoll 5 years ago
parent 3c8b3fba9f
commit cf740add85

@ -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 {

Loading…
Cancel
Save