Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 55816a8

Browse files
committed
Avoid attempting proxy creation for records
Fixed the configuration processor related to validation to avoid attempting proxy creation for final types (and records are final). Fixes #1522
1 parent 97c2f95 commit 55816a8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-aot/src/main/java/org/springframework/validation/annotation/ValidatedNativeConfigurationProcessor.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.validation.annotation;
1818

19+
import java.lang.reflect.Modifier;
1920
import java.util.LinkedHashSet;
2021

2122
import org.apache.commons.logging.Log;
@@ -69,7 +70,7 @@ void process(ConfigurableListableBeanFactory beanFactory, NativeConfigurationReg
6970
logger.debug("creating native JDKProxy configuration for these interfaces: "+interfaces);
7071
registry.proxy().add(NativeProxyEntry.ofInterfaceNames(interfaces.toArray(new String[0])));
7172
}
72-
} else if (!beanType.isInterface()) {
73+
} else if (!beanType.isInterface() && !Modifier.isFinal(beanType.getModifiers())) { // record types are final
7374
logger.debug("creating AOTProxy for this class: "+beanType.getName());
7475
registry.proxy().add(NativeProxyEntry.ofClass(beanType,ProxyBits.IS_STATIC));
7576
}

0 commit comments

Comments
 (0)