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); }