使用guava得到某个包下的某个的注解的所有的值

 


    org.reflections
    reflections
    0.9.11



    com.google.guava
    guava
    25.1-jre

 

Reflections reflections = new Reflections("com.fangfa.jiliang.controller");
Set> classesList = reflections.getTypesAnnotatedWith(Controller.class);
for(Class clazz : classesList) {
    Annotation[] annotationsByType = clazz.getAnnotationsByType(Controller.class);
    for (Annotation a:annotationsByType) {
        Controller c = (Controller)a;
        System.out.println(c.value());
    }
}

 

 

 

你可能感兴趣的:(java)