In a native image, an annotation will have no attributes until a dedicated hint is added, i.e.
{
"name": "org.springframework.core.annotation.Order",
"allDeclaredMethods": true
}
Without the above, the value
attribute of Order is not available. Creating a process that handles all org.springframework
annotations comes to mind, but there are a number of annotations that are build specific and should not be included. This includes anything configuration-class parsing related (such as @Configuration
, @Bean
, etc) and anything that has an explicit AOT handling that makes the annotation irrelevant at runtime.
Two ways comes to mind:
- Meta-annotate the annotation to indicate it does not have to be visible at runtime.
- Create a contract that contributions could implement to indicate the annotations that they handle.
Comment From: snicoll
Juergen and I chatted about this one and we're not sure if we want to create such a wide mechanism.
We feel that processing @Reflective
-annotated annotations (see #28469) with a set of per-defined registrars for core concepts (web, etc) should cover quite some ground. We'll first give this a try and then figure out what we want to do here.
Comment From: snicoll
It looks like the above should work. If that turns out to be needed after all, we can reopen.