1、Class    isAnnotationPresent(isAnnotationPresent(Class<? extends Annotation> annotationClass))
Class a = ...
boolean hasAnnotation = a.isAnnotationPresent(Controller.class)
判断a是否有Controller注解

2、AnnotationUtils.findAnnotation(Class<?> clazz, @Nullable Class<A> annotationType)

AnnotationUtils.findAnnotation(Method method, @Nullable Class<A> annotationType)

Class a = bean.getClass()
Controller subscriber = AnnotationUtils.findAnnotation(a, Controller.class);

 3、spring扫描工具类ClassPathBeanDefinitionScanner:可根据指定包名扫描指定beandefinition 相关集合信息

// 关闭默认过滤器
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
// 添加自定义过滤器(包含),排除使用addExcludeFilter
provider.addIncludeFilter(new AnnotationTypeFilter(Entity.class));
// 扫描指定classpath或者包路径下的bean定义
Set<BeanDefinition> beanDefinitions = provider.findCandidateComponents(basePackage)
常用的过滤器
AnnotationTypeFilter 注解类
AssignableTypeFilter 被继承的类