From 2f4a78ee38bceeab99a5396f4f7a63ac2f513aa7 Mon Sep 17 00:00:00 2001 From: huazhongming Date: Fri, 15 Dec 2023 17:12:23 +0800 Subject: [PATCH] Fix reference bean create proxy with javassist in native (#13509) Signed-off-by: crazyhzm --- .../org/apache/dubbo/config/spring/ReferenceBean.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ReferenceBean.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ReferenceBean.java index be84f01477f..7bcf1092e26 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ReferenceBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ReferenceBean.java @@ -16,6 +16,7 @@ */ package org.apache.dubbo.config.spring; +import org.apache.dubbo.common.aot.NativeDetector; import org.apache.dubbo.common.bytecode.Proxy; import org.apache.dubbo.common.constants.CommonConstants; import org.apache.dubbo.common.logger.ErrorTypeAwareLogger; @@ -364,7 +365,12 @@ private void createLazyProxy() { } } - if (StringUtils.isEmpty(this.proxy) || CommonConstants.DEFAULT_PROXY.equalsIgnoreCase(this.proxy)) { + if (NativeDetector.inNativeImage()) { + generateFromJdk(interfaces); + } + + if (this.lazyProxy == null + && (StringUtils.isEmpty(this.proxy) || CommonConstants.DEFAULT_PROXY.equalsIgnoreCase(this.proxy))) { generateFromJavassistFirst(interfaces); }