I'm using spring native to build a native-image with graalvm, i want to find all classes that implements a specific interface I tried using Reflections but it didn't work, i used spring's ClassPathScanningCandidateComponentProvider too :
It works fine when i run it as a jar file, but when i try to run the native-image .exe file it does not find any classes
this is my code
String[] basePackages = {"com.demo","com.demo2"};
Set<Class<? extends Initializer>> subClasses = new HashSet<>();
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
scanner.addIncludeFilter(new AssignableTypeFilter(Initializer.class));
for (String basePackage : basePackages) {
Set<?> classes = scanner.findCandidateComponents(basePackage).stream().peek(l->System.out.println(l)).collect(Collectors.toSet());
subClasses.addAll((Set<Class<? extends Initializer>>) classes);
}
PS : the class SubscriberRegistration implements the interface Initializer and my reflect.json file :
[ {
"name" : "com.demo.projectinstallerparent.SubscriberRegistration",
"methods": [
{ "name": "<init>", "parameterTypes": [] }
]}]