Skip to content

Commit f1261bf

Browse files
committed
configuration-processor: detect @nullable on TYPE_USE parameters
Update MetadataGenerationEnvironment#getAnnotation to also inspect type-use annotations (element.asType().getAnnotationMirrors()) in addition to declaration annotations. This ensures that @nullable on method parameter types is correctly detected when generating configuration metadata for Actuator endpoints. Previously, parameters annotated with @nullable in TYPE_USE position could be missed, causing them to be marked as required in metadata. With this change, both declaration-level and type-use @nullable annotations are recognized. No new dependencies are introduced, and existing public APIs remain unchanged. Signed-off-by: wonyongg <[email protected]>
1 parent 7a8b337 commit f1261bf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,12 @@ AnnotationMirror getAnnotation(Element element, String type) {
265265
return annotation;
266266
}
267267
}
268+
269+
for (AnnotationMirror annotation : element.asType().getAnnotationMirrors()) {
270+
if (type.equals(annotation.getAnnotationType().toString())) {
271+
return annotation;
272+
}
273+
}
268274
}
269275
return null;
270276
}

0 commit comments

Comments
 (0)