问题
I can't find a general utilities (static methods) library for querying for annotations other than either using the annotations api directly and writing my own or using Springs:
- Springs Annotation Utils
Normally I would not mind using Springs but its a rather big dependency just for dealing with annotations. Maybe Commons Lang will have AnnotationUtils some day.
What are people using to query for Annotations?
回答1:
With version 2.5.6 of Spring, it was possible to use spring.jar (2.8 MB) as dependency. With version 3, that's not possible. Instead you have to add dependency to the core, beans, context, asm and expression module as a minimum to start the container.
Since you only the AnnotationUtils
class, it's sufficient with the core module.
You can find the Ivy and Maven element together with a download link here:
http://www.springsource.com/repository/app/search?query=AnnotationUtils
Its size is 350 KB versus Apache Commons Lang 2.4 on 258 KB.
来源:https://stackoverflow.com/questions/3000480/is-there-commons-annotationutils-like-library-java