ApplicationContextHolder add query based on annotation.

pull/161/head
chen.ma 3 years ago
parent 54bf27ed22
commit a02a7a0d2a

@ -4,6 +4,7 @@ import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import java.lang.annotation.Annotation;
import java.util.Map;
/**
@ -55,4 +56,16 @@ public class ApplicationContextHolder implements ApplicationContextAware {
return CONTEXT.getBeansOfType(clazz);
}
/**
* Find whether the bean has annotations.
*
* @param beanName
* @param annotationType
* @param <A>
* @return
*/
public static <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) {
return CONTEXT.findAnnotationOnBean(beanName, annotationType);
}
}

Loading…
Cancel
Save