Skip to content

Commit

Permalink
Fix for ServiceLoaderFeature (#11402)
Browse files Browse the repository at this point in the history
ServiceLoaderFeature did not include all the @requires annotations, as some were added with the @requirements. I included such in the native-image beforeAnalysis. As an example, this fixes the usage of condition in io.micronaut.configuration.metrics.binder.web.ClientRequestMetricRegistryFilter.
  • Loading branch information
andriy-dmytruk authored Dec 3, 2024
1 parent c914e42 commit a1d34fa
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ public void beforeAnalysis(BeforeAnalysisAccess access) {
}
Class<?> beanType = beanInfo.getBeanType();
List<AnnotationValue<Annotation>> values = beanInfo.getAnnotationMetadata().getAnnotationValuesByName("io.micronaut.context.annotation.Requires");
if (values.isEmpty()) {
AnnotationValue<Annotation> requirements = beanInfo.getAnnotationMetadata().getAnnotation("io.micronaut.context.annotation.Requirements");
if (requirements != null) {
values = requirements.getAnnotations("value");
}
}
if (!values.isEmpty()) {
for (AnnotationValue<Annotation> value : values) {
String[] classNames = EMPTY_STRING_ARRAY;
Expand Down

0 comments on commit a1d34fa

Please sign in to comment.