Spring里的applicationContext.getBeansWithAnnotation

getBeansWithAnnotation


Map<String,Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType)
throws BeansException


Find all beans whose Class has the supplied Annotation type.


Parameters:
annotationType - the type of annotation to look for
Returns:
a Map with the matching beans, containing the bean names as keys and the corresponding bean instances as values
Throws:
BeansException - if a bean could not be created

posted @ 2018-12-05 16:46  尐鱼儿  阅读(3945)  评论(0编辑  收藏  举报