Resources at root

34 views
Skip to first unread message

tah...@gmail.com

unread,
Apr 15, 2013, 3:27:40 AM4/15/13
to google-code...@googlegroups.com
Hi 

how can we configure a Reflections instance so Classes are fetched according one package with multiple scanner 
and resources at the Root. I tried something like this with no success.


 
new Reflections(new ConfigurationBuilder()
 
.filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix("my.project.prefix")))   .setScanners(new SubTypesScanner(), new TypeAnnotationsScanner(), new ResourcesScanner() // <- want '/' for resources .filterResultBy(myFilter) )
  ...))

Can you give me a hint to achieve this ?

Thank you

mamo

unread,
Apr 15, 2013, 3:51:16 AM4/15/13
to google-code...@googlegroups.com, tah...@gmail.com
does new Reflections(new ResourcesScanner(), ClasspathHelper.for...()) scans what you need?
generally, it's not a good idea to look for resources on the root, but use a predefined prefix (for example META-INF/whatever). that way it is possible to find the relevant urls (using classLoader.getResources()) and not just scan everything. 

tah...@gmail.com

unread,
Apr 15, 2013, 4:45:46 PM4/15/13
to google-code...@googlegroups.com, tah...@gmail.com
I'll definitely use a predefined prefix inside META-INF/.
I agree it is a good practice. 

I try your method right now. Keep you inform.
Reply all
Reply to author
Forward
0 new messages