I'm using org.reflections:reflections to find annotated classes on the classpath within a Spring Boot application. When running the app from the IDE, everything works fine. But when I build the FAT-JAR and run it directly, it can't find some classes. Here's a simplified version of my code:
// packagePrefixes is an array of strings
Reflections reflections = new Reflections(packagePrefixes, Scanners.TypesAnnotated);
for (Class<?> clazz : reflections.getTypesAnnotatedWith(Resource.BaseClass.class)) {
// This works, it'll iterate through this
}
for (Class<?> clazz : reflections.getTypesAnnotatedWith(Listener.class)) {
// This doesn't work, it won't iterate through this
}
Both annotations are annotated with
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
I already tried using precise packages so that the library won't need to iterate recursively.
Does anyone know what the problem is here? Thanks for your help :)
Aucun commentaire:
Enregistrer un commentaire