Class TypeExcludeFilter

java.lang.Object
org.springframework.boot.context.TypeExcludeFilter
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.core.type.filter.TypeFilter

public class TypeExcludeFilter extends Object implements org.springframework.core.type.filter.TypeFilter, org.springframework.beans.factory.BeanFactoryAware
Provides exclusion TypeFilters that are loaded from the BeanFactory and automatically applied to SpringBootApplication scanning. Can also be used directly with @ComponentScan as follows:
 @ComponentScan(excludeFilters = @Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class))
 

Implementations should provide a subclass registered with BeanFactory and override the match(MetadataReader, MetadataReaderFactory) method. They should also implement a valid hashCode and equals methods so that they can be used as part of Spring test's application context caches.

Note that TypeExcludeFilters are initialized very early in the application lifecycle, they should generally not have dependencies on any other beans. They are primarily used internally to support spring-boot-test.

Since:
1.4.0
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
     
    boolean
    match(org.springframework.core.type.classreading.MetadataReader metadataReader, org.springframework.core.type.classreading.MetadataReaderFactory metadataReaderFactory)
     
    void
    setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TypeExcludeFilter

      public TypeExcludeFilter()
  • Method Details

    • setBeanFactory

      public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      Throws:
      org.springframework.beans.BeansException
    • match

      public boolean match(org.springframework.core.type.classreading.MetadataReader metadataReader, org.springframework.core.type.classreading.MetadataReaderFactory metadataReaderFactory) throws IOException
      Specified by:
      match in interface org.springframework.core.type.filter.TypeFilter
      Throws:
      IOException
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object