Skip to content

Commit bb446a3

Browse files
committed
Merge pull request #31433 from martin-lukas
* pr/31433: Polish "Ignore @value on record property" Ignore @value on record property Closes gh-31433
2 parents 6ec2642 + f3dce4b commit bb446a3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,10 @@ private InjectionMetadata buildAutowiringMetadata(Class<?> clazz) {
582582
return;
583583
}
584584
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)