In Spring 5, AnnotationUtils.findAnnotation(Class<?>, Class<A>) would find the annotation on the following class: Object foo = new @MyAnnotation Object() {};, e.g. AnnotationUtils.findAnnotation(foo, MyAnnotation.class) would not return null.

With Spring 6.0.0-M5 / Java 17 the annotation will no longer be found.

Comment From: snicoll

Thanks for the report. We don't need both a PR and an issue so I am going to close this one in favor of the PR where we can continue the discussion.