I want to do classpath scanning using some existing library. extcos seems to be a good candidate, because it supports JBoss’s VFS out of the box.
Is it possible to run extcos (or some other classpath scanning tool), to that
- FS-based, JAR-based and JBoss’s VFS’s based classpaths are supported
- and only classes matching specific pattern (like
com.example.*.entity) are loaded?
The first prerequisite seems to be already satisfied by extcos, but i’m unable to get the second one. It may happen that i have some weird classes in com.example package and i don’t want to load them, not even try.
I decided to use Spring’s application context class path scanning (i.e. resource loading) capabilities. This handles at least FS (file system) and Jar based class paths out of the box.
When on JBoss 5+, i use Snowdrop‘s application context implementation that adds VFS support transparently for the application.
Since i’m using resource loading by pattern, i get package filtering, and even class name filtering for free.