diff --git a/common/src/main/java/com/github/dynamic/threadpool/common/config/ApplicationContextHolder.java b/common/src/main/java/com/github/dynamic/threadpool/common/config/ApplicationContextHolder.java index 145e32ab..66ce5bb0 100644 --- a/common/src/main/java/com/github/dynamic/threadpool/common/config/ApplicationContextHolder.java +++ b/common/src/main/java/com/github/dynamic/threadpool/common/config/ApplicationContextHolder.java @@ -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 + * @return + */ + public static A findAnnotationOnBean(String beanName, Class annotationType) { + return CONTEXT.findAnnotationOnBean(beanName, annotationType); + } + }