dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

[Enhancement] Refactoring the parser of dubbo config BeanDefinitions in XML configuration

Open mercyblitz opened this issue 6 years ago • 12 comments

The org.apache.dubbo.config.spring.schema.DubboBeanDefinitionParser is too complicated to maintain, which is used to parse 13 BeanDefinitions of Dubbo config, thus, it'd better be refactored by the small modules for every Dubbo config.

  • Adding attributes

    • id attribute for <dubbo:config-center /> , <dubbo:monitor /> and <dubbo:metadata-report />
  • Deprecated attributes

    • <protocol keepalive="true" /> to be replaced by <protocol keep-alive="true" />
  • Removing attributes

    • forks attribute of <dubbo:registry />

mercyblitz avatar Apr 22 '20 01:04 mercyblitz

我认为重构他不是一个好主意,这是一个稳定的代遗弃的的模块。唯一的瑕疵只是众多普通bean中,refenceBean的beanDefinition存在提前暴露的问题,修复也非常的简单

CodeIngL avatar Apr 22 '20 02:04 CodeIngL

我认为重构他不是一个好主意,这是一个稳定的代遗弃的的模块。唯一的瑕疵只是众多普通bean中,refenceBean的beanDefinition存在提前暴露的问题,修复也非常的简单

Thanks for your advice, a new Java System Property dubbo.experimental.bean-definition-parser will be introduced into Dubbo 2.7.7 to swtich it on or not.

mercyblitz avatar Apr 24 '20 07:04 mercyblitz

@mercyblitz After upgrading dubbo to 2.7.7, this problem is not fixed, is it because the code has not been merged into the main branch?

also see dubbo-spring-boot-project #695

r9yn avatar May 19 '20 03:05 r9yn

我认为重构他不是一个好主意,这是一个稳定的代遗弃的的模块。唯一的瑕疵只是众多普通bean中,refenceBean的beanDefinition存在提前暴露的问题,修复也非常的简单

请问怎么修复呢?小马哥的补丁并没有打到2.7.7里,目测2.7.8也没有。

Da-Hong avatar Jul 06 '20 09:07 Da-Hong

在2.7.7源码包里更新了小马哥的补丁试了还是不行,目前这个方案有效果,但不知道有没有其他副作用 #5710

Da-Hong avatar Jul 07 '20 08:07 Da-Hong

肯定有副作用呀,RefernceBean本质上就是FactoryBean,你给他设定tagertType,逻辑上就不是FactoryBean。完全破坏了spring的结构,现在看解决方法是加lazy。是为了解决而解决么。从根源上就错了

CodeIngL avatar Jul 07 '20 09:07 CodeIngL

肯定有副作用呀,RefernceBean本质上就是FactoryBean,你给他设定tagertType,逻辑上就不是FactoryBean。完全破坏了spring的结构,现在看解决方法是加lazy。是为了解决而解决么。从根源上就错了

方便讲下解决方案吗?

Da-Hong avatar Jul 07 '20 13:07 Da-Hong

image 在这里应该使用decoratedDefinition来进行暴露问题,如果你快速定制dubbo,你可以参考https://github.com/open-wrapper/dubbo-wrapper

CodeIngL avatar Jul 08 '20 02:07 CodeIngL

这bug超级久了,就是 不修,我也是醉了。 不是有专门spring生态的团队么

CodeIngL avatar Jul 08 '20 02:07 CodeIngL

#5976 差不多是同一个问题,感谢 @CodeIngL支持,贴下代码,放在parse方法return前面

if (ReferenceBean.class.equals(beanClass)) {
    Object className = beanDefinition.getPropertyValues().get("interface");
    if (className != null) {
        RootBeanDefinition copy = beanDefinition.cloneBeanDefinition();
        copy.setBeanClassName(String.valueOf(className));
        beanDefinition.setDecoratedDefinition(new BeanDefinitionHolder(copy, id));
    }
}

Da-Hong avatar Jul 08 '20 07:07 Da-Hong

image 在这里应该使用decoratedDefinition来进行暴露问题,如果你快速定制dubbo,你可以参考https://github.com/open-wrapper/dubbo-wrapper

你好,我试了下这个方法是可以使用的,可以解决我的问题。 看下下DecoratedDefinition的相关源码,对这个不太理解,有没有详细的文章或者博客介绍

furaul avatar Dec 01 '20 09:12 furaul

这个是spring的东西,可以参考相关api

------------------ 原始邮件 ------------------ 发件人: "furaul"<[email protected]>; 发送时间: 2020年12月1日(星期二) 下午5:45 收件人: "apache/dubbo"<[email protected]>; 抄送: "codeL"<[email protected]>; "Mention"<[email protected]>; 主题: Re: [apache/dubbo] [Enhancement] Refactoring the parser of dubbo config BeanDefinitions in XML configuration (#6039)

在这里应该使用decoratedDefinition来进行暴露问题,如果你快速定制dubbo,你可以参考https://github.com/open-wrapper/dubbo-wrapper

你好,我试了下这个方法是可以使用的,可以解决我的问题。 看下下DecoratedDefinition的相关源码,对这个不太理解,有没有详细的文章或者博客介绍

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

CodeIngL avatar Dec 01 '20 10:12 CodeIngL