I have few classes that I need to annotate with a name so I defined my annotation as
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @i
In my case I wrote like below:
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
scanner.addIncludeFilter(new AnnotationTypeFilter(JsonUnmarshallable.class));
Set definitions = scanner.findCandidateComponents("base.package.for.scanning");
for(BeanDefinition d : definitions) {
String className = d.getBeanClassName();
String packageName = className.substring(0,className.lastIndexOf('.'));
System.out.println("packageName:" + packageName + " , className:" + className);
}