I'm upgrading from org.reflections:reflections:0.9.5 to version 0.9.9. I am using:
Reflections reflectionPaths = new Reflections("resources", new TypeAnnotationsScanner());
Set<Class<?>> rootResourceClasses = reflectionPaths.getTypesAnnotatedWith(Path.class);
Which gets me all classes in the resources
package with an @Path
Annotation.
Since the library has been updated the top line requires an extra new SubTypesScanner()
for the code to run. I however do not want sub types to be returned.
How can I use this new version of the library to pull back only classes and interfaces that are not sub types?
I get this Exception if I don't include the SubTypesScanner
org.reflections.ReflectionsException: Scanner SubTypesScanner was not configured
at org.reflections.Store.get(Store.java:58)
at org.reflections.Store.get(Store.java:70)
at org.reflections.Store.getAll(Store.java:97)
at org.reflections.Reflections.getAllAnnotated(Reflections.java:423)
at org.reflections.Reflections.getTypesAnnotatedWith(Reflections.java:384)
at org.reflections.Reflections.getTypesAnnotatedWith(Reflections.java:370)
I believe you using this annotation "javax.ws.rs.Path". Pls try this :-
Reflections reflectionPaths = new Reflections("resources", new TypeAnnotationsScanner());
Set<Class<?>> rootResourceClasses = reflectionPaths.getTypesAnnotatedWith(Path.class, true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With