From 591daf84ec86fd4639807ce335019881544664f0 Mon Sep 17 00:00:00 2001 From: HzjNeverStop <441627022@qq.com> Date: Tue, 13 Sep 2022 11:46:38 +0800 Subject: [PATCH] Fix null value of ReferenceFactory.getObjectType. (#1014) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 致节 --- .../sofa/runtime/spring/factory/ReferenceFactoryBean.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/factory/ReferenceFactoryBean.java b/sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/factory/ReferenceFactoryBean.java index f361eaf48..20150117a 100644 --- a/sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/factory/ReferenceFactoryBean.java +++ b/sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/factory/ReferenceFactoryBean.java @@ -79,7 +79,13 @@ public Object getObject() throws Exception { @Override public Class getObjectType() { - return getInterfaceClass(); + try { + Class type = getInterfaceClass(); + return type != null ? type : ReferenceFactoryBean.class; + } catch (Throwable t) { + // Class not found + return ReferenceFactoryBean.class; + } } @Override