I want to create an App Component that:
Say I have an annotation:
public @interface MyAnnotation {
String description();
}
I want to create a Application Context listener bean using:
@Component("daryn_RegisterMyClasses_ApplicationContextListener")
public class RegisterMyClasses {
@EventListener
public void applicationContextInitialized(AppContextInitializedEvent event) {
// HERE SCAN ALL CORE PACKAGES FOR CLASSES WITH MY ANNOTATION
}
}
And I want to scan all ‘CORE’ packages to find classes with @MyAnnotation
.
So say my AppComponent is called com.daryn.myappcomponent
And I include this app component as a dependency to a new project called: com.someproject.other
How should I get my component daryn_RegisterMyClasses_ApplicationContextListener
to scan the core module of both of these packages efficiently?
Does Cuba have some sort of ‘Reflections’ interface or other to scan just core packages?
As I can’t really do:
Reflections reflections = new Reflections("dont know what this is yet");
Set<Class<?>> annotated = reflections.getTypesAnnotatedWith(MyAnnotation.class);
Any advise appreciated.