-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Avoid proxy hint generation for annotations that are never synthesized #28769
Comments
|
@sbrannen can we please clarify the scope of this? |
Yes, that should help. My original concern was that we generate too many hints for We should now be using So, we could consider introducing a method such as
I've covered part of the brainstorming above regarding the introduction of another "for reflection only" registration method. The second part is to document specific use cases in the Javadoc to make it clear to the user when to use which The last part was about automating the process of invoking Does that make sense now? |
I am not 100% sure but it looks like this issue, as described, is supesrseded now |
Indeed it may be superseded now. I'll take another pass later in the week. |
Closing in light of #28967 and related recent changes. If the need arises, we can reopen this issue at a later date. |
Overview
We can reduce the amount of generated proxy configuration and the native footprint by avoiding inclusion of unused annotation proxy classes in the native images.
Rationale
Annotations like
@GetMapping
in Spring MVC are composed annotations for@RequestMapping
; however, there is nowhere in the core Spring Framework where a lookup is performed for a@GetMapping
annotation. Rather, the corresponding lookups are only for merged@RequestMapping
annotations.Consequently,
@RequestMapping
needs to be synthesized, but the composed annotations@GetMapping
,@PostMapping
, etc. do not need to be synthesized.In other words,
WebAnnotationsRuntimeHintsRegistrar.registerHints()
can be greatly simplified.Brainstorming
We could analyze how we use
RuntimeHintsUtils.registerAnnotation
, simplify our usage by only registering annotations we know will need to be synthesized, and update the documentation to reflect this mindset/guidance.We could introduce support (potentially in the agent) to detect the use of
@AliasFor
referencing a meta-annotation's attribute and automatically register the target meta-annotation for a synthesized annotation proxy.Related Issues
The text was updated successfully, but these errors were encountered: