Skip to content

Commit f3dce4b

Browse files
committed
Polish "Ignore @value on record property"
See gh-31433
1 parent 70cb96c commit f3dce4b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,11 @@ private InjectionMetadata buildAutowiringMetadata(Class<?> clazz) {
581581
}
582582
return;
583583
}
584-
if (!method.getDeclaringClass().isRecord() && method.getParameterCount() == 0) {
584+
if (method.getParameterCount() == 0) {
585+
if (method.getDeclaringClass().isRecord()) {
586+
// Annotations on the compact constructor arguments made available on accessors, ignoring.
587+
return;
588+
}
585589
if (logger.isInfoEnabled()) {
586590
logger.info("Autowired annotation should only be used on methods with parameters: " +
587591
method);

0 commit comments

Comments
 (0)