Polish "Ignore @Value on record property"

See gh-31433
This commit is contained in:
Stéphane Nicoll 2023-10-23 11:20:49 +02:00
parent 70cb96c1d8
commit f3dce4bb9a
1 changed files with 5 additions and 1 deletions

View File

@ -581,7 +581,11 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
} }
return; 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()) { if (logger.isInfoEnabled()) {
logger.info("Autowired annotation should only be used on methods with parameters: " + logger.info("Autowired annotation should only be used on methods with parameters: " +
method); method);