Add TestExcludeFilter for component scanning
Add a new TypeFilter specifically for excluding candidate components. The filter is applied to `@SpringBootApplication` and allows tests to dynamically contribute exclude filters so that specific classes of component can be excluded. See gh-5295 See gh-4901
This commit is contained in:
@@ -24,9 +24,12 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
import org.springframework.boot.context.TypeExcludeFilter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.ComponentScan.Filter;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.FilterType;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
|
||||
/**
|
||||
@@ -46,7 +49,7 @@ import org.springframework.core.annotation.AliasFor;
|
||||
@Inherited
|
||||
@SpringBootConfiguration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@ComponentScan(excludeFilters = @Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class))
|
||||
public @interface SpringBootApplication {
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user