List of usage examples for org.springframework.core.type StandardMethodMetadata isAnnotated
default boolean isAnnotated(String annotationName)
From source file:com.quancheng.saluki.boot.runner.GrpcServiceRunner.java
private Collection<Object> getTypedBeansWithAnnotation(Class<? extends Annotation> annotationType) throws Exception { return Stream.of(applicationContext.getBeanNamesForAnnotation(annotationType)).filter(name -> { BeanDefinition beanDefinition = applicationContext.getBeanFactory().getBeanDefinition(name); if (beanDefinition.getSource() instanceof StandardMethodMetadata) { StandardMethodMetadata metadata = (StandardMethodMetadata) beanDefinition.getSource(); return metadata.isAnnotated(annotationType.getName()); }/*from w ww .j a va 2 s . c om*/ return null != applicationContext.getBeanFactory().findAnnotationOnBean(name, annotationType); }).map(name -> applicationContext.getBeanFactory().getBean(name)).collect(Collectors.toList()); }