Java annotation scanning with spring
问题 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 @interface JsonUnmarshallable { public String value(); } Now the class that needs this annotation is defined as @JsonUnmarshallable("myClass") public class MyClassInfo { <few properties> } I used below code to scan the annotations private <T> Map<String, T> scanForAnnotation(Class<JsonUnmarshallable> annotationType) {