Scanning Java annotations at runtime

How do I search the whole classpath for an annotated class?

I’m doing a library and I want to allow the users to annotate their classes, so when the Web application starts I need to scan the whole classpath for certain annotation.

I’m thinking about something like the new functionality for Java EE 5 Web Services or EJB’s. You annotate your class with @WebService or @EJB and the system finds these classes while loading so they are accessible remotely.

13 Answers
13

Leave a Comment