Class ClassPathScanningAnnotationProvider
- java.lang.Object
-
- org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider
-
- com.github.frtu.spring.annotation.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.ClassPathScanningCandidateComponentProviderSearch for all classes that has certain annotation at class level usingfindCandidateComponents(Class). Can also limit research under a specific basePackage usingfindCandidateComponents(Class, String)- Since:
- 1.0.2
- See Also:
- Moved from old project SimpleToolbox
-
-
Constructor Summary
Constructors Constructor Description ClassPathScanningAnnotationProvider()
-
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 booleanisCandidateComponent(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
-
-
-
-
Method Detail
-
isCandidateComponent
protected boolean isCandidateComponent(org.springframework.beans.factory.annotation.AnnotatedBeanDefinition beanDefinition)
- Overrides:
isCandidateComponentin classorg.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
BeanDefinitionhaving 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.classbasePackage- Only subpackage of basePackage is scan- Returns:
- Set of all
BeanDefinitionhaving 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.classbasePackage- Only subpackage of basePackage is scanclassLoader- Pass a specific classloader to scan- Returns:
- Set of all
BeanDefinitionhaving class annotation DesiredAnnotation
-
-