-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Ensure indexer gracefully handle missing meta annotations #22385
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
I've actually noticed that issue working on a prototype for another feature on master
. I don't like the idea of using reflection and perhaps we could catch an exception when collection meta annotations on an annotation that is not present? If we can narrow the catch to that specific use case, I think that is better than using Class.forName
.
Thoughts?
...er/src/main/java/org/springframework/context/index/processor/IndexedStereotypesProvider.java
Outdated
Show resolved
Hide resolved
Sounds good to me - I'll try to update the PR accordingly at some point today. |
3a67d82
to
42b9b69
Compare
I've updated the PR so that we now catch an exception when collecting meta annotations. |
* pr/22385: Polish "Ensure indexer gracefully handle missing meta annotations" Ensure indexer gracefully handle missing meta annotations
Thanks @vpavic your fix was almost identical to the one I had in my spike for another feature. |
If
spring-context-indexer
is used in an application that uses@javax.transaction.Transactional
, compilation will fail due tojavax.interceptor.InterceptorBinding
not being available.This can be easily reproduced with a project as simple as:
This PR addresses the problem by adding a classpath presence check for annotation before proceeding to collect its stereotypes.