I use Reflections (
http://code.google.com/p/reflections ) to get:
- classes annotated with a particular annotation
- fields annotated with a particular annotation
I don't think Play provide a way to get fields annotated with a particular annotation (in its ApplicationClasses and ApplicationClassloader classes).
In DEV mode, it works great when I provide Reflections with those "urls" to search the classes in:
#1 new File(Play.applicationPath + "/tmp/classes/").toURI().toURL()
or
#2 org.reflections.util.ClasspathHelper.forClassLoader(Play.classloader);
But In PROD mode:
#1 doesn't work since the .class files are not generated in the "tmp" folder.
#2 works on Windows, but not on my prod Linux box! I have no idea why! It seems Reflections is not able to find my application classes when using org.reflections.util.ClasspathHelper.forClassLoader(Play.classloader)! I also tried org.reflections.util.ClasspathHelper.forClassLoader(Thread.currentThread().getContextClassLoader()) but still no luck!
Any idea? Are some .class files actually generated somewhere in PROD mode?
How can I make Reflections aware of them?