Class ClassPathScanningAnnotationProvider

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.context.ResourceLoaderAware, org.springframework.core.env.EnvironmentCapable

    public class ClassPathScanningAnnotationProvider
    extends org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider
    Search for all classes that has certain annotation at class level using findCandidateComponents(Class). Can also limit research under a specific basePackage using findCandidateComponents(Class, String)
    Since:
    1.0.2
    See Also:
    Moved from old project SimpleToolbox
    • Field Summary

      • Fields inherited from class org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider

        logger
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Set<org.springframework.beans.factory.config.BeanDefinition> findCandidateComponents​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
      Simplest scan for class annotation in all packages.
      static java.util.Set<org.springframework.beans.factory.config.BeanDefinition> findCandidateComponents​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.String basePackage)
      Scan for class annotation under basePackage.
      static java.util.Set<org.springframework.beans.factory.config.BeanDefinition> findCandidateComponents​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.String basePackage, java.lang.ClassLoader classLoader)
      Scan for class annotation under basePackage for that specific classloader (when many involved and result not found).
      protected boolean isCandidateComponent​(org.springframework.beans.factory.annotation.AnnotatedBeanDefinition beanDefinition)  
      • Methods inherited from class org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider

        addExcludeFilter, addIncludeFilter, clearCache, findCandidateComponents, getEnvironment, getMetadataReaderFactory, getRegistry, getResourceLoader, isCandidateComponent, registerDefaultFilters, resetFilters, resolveBasePackage, setEnvironment, setMetadataReaderFactory, setResourceLoader, setResourcePattern
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ClassPathScanningAnnotationProvider

        public ClassPathScanningAnnotationProvider()
    • Method Detail

      • isCandidateComponent

        protected boolean isCandidateComponent​(org.springframework.beans.factory.annotation.AnnotatedBeanDefinition beanDefinition)
        Overrides:
        isCandidateComponent in class org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider
      • findCandidateComponents

        public static java.util.Set<org.springframework.beans.factory.config.BeanDefinition> findCandidateComponents​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
        Simplest scan for class annotation in all packages.
        Parameters:
        annotationType - DesiredAnnotation.class
        Returns:
        Set of all BeanDefinition having class annotation DesiredAnnotation
      • findCandidateComponents

        public static java.util.Set<org.springframework.beans.factory.config.BeanDefinition> findCandidateComponents​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
                                                                                                                     java.lang.String basePackage)
        Scan for class annotation under basePackage.
        Parameters:
        annotationType - DesiredAnnotation.class
        basePackage - Only subpackage of basePackage is scan
        Returns:
        Set of all BeanDefinition having class annotation DesiredAnnotation
      • findCandidateComponents

        public static java.util.Set<org.springframework.beans.factory.config.BeanDefinition> findCandidateComponents​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
                                                                                                                     java.lang.String basePackage,
                                                                                                                     java.lang.ClassLoader classLoader)
        Scan for class annotation under basePackage for that specific classloader (when many involved and result not found).
        Parameters:
        annotationType - DesiredAnnotation.class
        basePackage - Only subpackage of basePackage is scan
        classLoader - Pass a specific classloader to scan
        Returns:
        Set of all BeanDefinition having class annotation DesiredAnnotation