Skip to content

Commit b887d18

Browse files
committed
fix(native): Resolve NullPointerException in ReferenceBeanManager
This commit adds a defensive null-check for `moduleModel`. If it is null, it retrieves the model explicitly using `DubboBeanUtils.getModuleModel()` to prevent the `NullPointerException` and ensure stable initialization in native builds. fixes: #15663 Signed-off-by: Kyounghoon Jang <[email protected]>
1 parent a7b641f commit b887d18

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/reference/ReferenceBeanManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ public synchronized void initReferenceBean(ReferenceBean referenceBean) throws E
192192
// cache referenceConfig
193193
referenceConfigMap.put(referenceKey, referenceConfig);
194194

195+
// add a null check for moduleModel to be compatible with the native environment
196+
if (moduleModel == null) {
197+
moduleModel = DubboBeanUtils.getModuleModel(applicationContext);
198+
}
199+
195200
// register ReferenceConfig
196201
moduleModel.getConfigManager().addReference(referenceConfig);
197202
moduleModel.getDeployer().setPending();

0 commit comments

Comments
 (0)