To my knowledge, Guice doesn't do any classpath scanning out-of-the-box, 
though a lot of people have written code to do that.  So, there's nothing 
magic in an annotation in and of itself that will do anything to make Guice 
know about it.

Honestly, classpath scanning is evil - if you have managed classloaders it 
won't do what you expect (that includes test classloaders in some cases), 
and generally forcing the JVM to load every class on the classpath is a 
nasty, extreme solution.

Annotation processors are actually really easy to write.  Just have it 
collect the annotated classes at compile-time and write them out somewhere 
under, say, META-INF.  Then at runtime, load all such resources, parse them 
and use Class.forName to get your classes.  

Here's an example:

https://github.com/timboudreau/giulius/blob/master/giulius/src/main/java/com/mastfrog/giulius/annotations/processors/NamespaceAnnotationProcessor.java

-Tim

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to