Skip to content

[Issue] dubbo-spring-boot-stater模式下,使用xml配置registry,address获取失败 #6035

@mercyblitz

Description

@mercyblitz

问题描述

  • 客户端依赖dubbo-spring-boot-stater
  • 新建xml,配置<dubbo:registry id="spcRegistry" address="${dubbo.registry.address}"></dubbo:registry>
  • 程序启动时,dubbo.registry.address获取不到值,配置文件里面已经配置

问题分析

  • 程序启动时,org.apache.dubbo.spring.boot.beans.factory.config.DubboConfigBeanDefinitionConflictProcessor类会引起ReferenceBean提前加载,因为ReferenceBean实现了FactoryBean
  • 走进ReferenceBean.afterPropertiesSet,代码BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, RegistryConfig.class, false, false);获取到的注册中心address值是${dubbo.registry.address}
  • 因为第二步加载顺序优先于Bean工厂后置器,所以导致PlaceholderConfigurerSupport.doProcessProperties没加载没有跟Bean定义属性赋值
  • 所以服务注册的时候报错,提示连不上zk,原因就是dubbo.registry.address获取失败

The source : apache/dubbo-spring-boot-project#695

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions