Browse Source

Merge pull request #31433 from martin-lukas

* pr/31433:
  Polish "Ignore @Value on record property"
  Ignore @Value on record property

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

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

@ -582,6 +582,10 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA @@ -582,6 +582,10 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
return;
}
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