Skip to content
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

AnnotationUtils.getValue() may hide relevant errors [SPR-15481] #20041

spring-issuemaster opened this issue Apr 25, 2017 · 2 comments


Copy link

commented Apr 25, 2017

Oleg Zhurakousky opened SPR-15481 and commented

At the core of the issue are AliasFor type annotations which are synthesized into a proxy with SynthesizedAnnotationInvocationHandler which delegates to AbstractAliasAwareAnnotationAttributeExtractor.getAttributeValue(..) to get the actual annotation value. When it sees that this annotation is synthesized and has alias value mismatch it results in InvocationtargetException which is trapped inside of AnnotationUtils.getValue() operation which simply return null. This can and most likely will result in subsequent error downstream, but the error message may be misleading (see

IMHO, while I do believe that the initial intention of returning null for non existing attributes should stay, I also believe that we should trap InvocationTargetException and re-throw. While that may result in breaking change, it's one of those where it's for the good cause.

Affects: 4.3.8

Issue Links:

  • INT-4263 Misleading error message during misconfigured components.

Referenced from: pull request #1401, and commits 299b9d6, 17f274f, 16fdda0


This comment has been minimized.

Copy link
Collaborator Author

commented Apr 25, 2017

Oleg Zhurakousky commented

Juergen Hoeller
I've issued the PR #1401

Basically the idea is to catch InvocationTargetException see if its target is AnnotationConfigurationException and if so re-throw it. I actually noticed that we're already doing that in several other related operations, which made it a bit easier by delegating to already existing rethrowAnnotationConfigurationException(..);


This comment has been minimized.

Copy link
Collaborator Author

commented Apr 26, 2017

Sam Brannen commented


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.