Browse Source

Polish "Ignore @Value on record property"

See gh-31433
pull/31491/head
Stéphane Nicoll 1 year ago
parent
commit
f3dce4bb9a
  1. 6
      spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java

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

@ -581,7 +581,11 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA @@ -581,7 +581,11 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
}
return;
}
if (!method.getDeclaringClass().isRecord() && method.getParameterCount() == 0) {
if (method.getParameterCount() == 0) {
if (method.getDeclaringClass().isRecord()) {
// Annotations on the compact constructor arguments made available on accessors, ignoring.
return;
}
if (logger.isInfoEnabled()) {
logger.info("Autowired annotation should only be used on methods with parameters: " +
method);

Loading…
Cancel
Save