spring 获取对象的注解

BeanDefinition definition = registry.getBeanDefinition(name);
if (definition instanceof AnnotatedBeanDefinition) {
  AnnotatedBeanDefinition annotatedDefinition = (AnnotatedBeanDefinition) definition;
  addComponentScanningPackages(packages, annotatedDefinition.getMetadata());
}
原文地址:https://www.cnblogs.com/xiluhua/p/9461017.html