From 1b1682eacd9c8aabbb86f24dc9c54070f3dd18b4 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 3 Oct 2022 18:00:57 +0200 Subject: [PATCH] Narrow early initialization of CGLIB method proxies (for AOT processing) Do not trigger early initialization on Factory classes (e.g. AOP proxies) See gh-29107 --- .../java/org/springframework/cglib/proxy/MethodProxy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/cglib/proxy/MethodProxy.java b/spring-core/src/main/java/org/springframework/cglib/proxy/MethodProxy.java index 446cd09b9b..93cfcfc5a8 100644 --- a/spring-core/src/main/java/org/springframework/cglib/proxy/MethodProxy.java +++ b/spring-core/src/main/java/org/springframework/cglib/proxy/MethodProxy.java @@ -57,8 +57,8 @@ public class MethodProxy { proxy.createInfo = new CreateInfo(c1, c2); // SPRING PATCH BEGIN - if (!c1.isInterface() && c1 != Object.class) { - // Try early initialization for overridden methods on subclasses + if (!c1.isInterface() && c1 != Object.class && !Factory.class.isAssignableFrom(c2)) { + // Try early initialization for overridden methods on specifically purposed subclasses try { proxy.init(); }