-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Reading annotations in ConfigurationClassParser does not fall back to ASM on Google App Engine [SPR-16564] #21106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Juergen Hoeller commented So |
Madhura Bhave commented Yes exactly. For example, for a nested class that looks like this (where @Configuration
@ConditionalOnClass(FooClass.class)
protected static class Test {
} this is the log for @org.springframework.context.annotation.Configuration(value=)
@org.springframework.boot.autoconfigure.condition.ConditionalOnClass(name=[], value=sun.reflect.annotation.TypeNotPresentExceptionProxy) |
Juergen Hoeller commented Hmm that's rather awkward to find out though: We'd have to iterate over all attributes of all declared annotations and see whether any of them is a In what way does this break Boot's |
Madhura Bhave commented When Failed to introspect annotations on [class Foo]: java.lang.IllegalStateException: Could not obtain annotation attribute value for public abstract java.lang.Class[] org.springframework.boot.autoconfigure.condition.ConditionalOnClass.value() Boot then assumes that this class is not a candidate for |
Juergen Hoeller commented I've introduced an |
Juergen Hoeller commented Madhura Bhave, this is included in the upcoming 5.0.5 snapshot now. Please give it a try and let me know whether it actually helps on GAE... If it doesn't, it'd be great to debug |
Madhura Bhave commented Thanks, Juergen. I tested it on GAE. Looks like it didn't work because |
Juergen Hoeller commented Oops, indeed. I've extended that check to include Class arrays as well... Give it one more try with the upcoming snapshot please, hopefully it works for your purposes now! |
Madhura Bhave commented It works as expected now. thank you! |
Madhura Bhave opened SPR-16564 and commented
ConfigurationClassParser
has a sanity test to ensure that annotations can be read and in case of an Exception, it falls back to ASM. On Google App EngineclassType.getAnnotations()
does not throw an Exception if a class is not found and instead the annotation value looks something like thisvalue=sun.reflect.annotation.TypeNotPresentExceptionProxy
.This causes unexpected behavior in Spring Boot's
OnClassCondition
as the metadata is not anAnnotationMetadataReadingVisitor
.Affects: 4.3.14, 5.0.4
Issue Links:
@PropertySources
fails on JDK 7 due to@Repeatable
@Configuration
class parsing fallback to ASMReferenced from: commits 7cafa67, 967a2ef, 50e980c
Backported to: 4.3.15
The text was updated successfully, but these errors were encountered: