Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mercyblitz opened this issue Apr 22, 2020 · 12 comments
Assignees
Milestone

Comments

@mercyblitz
Copy link
Contributor

mercyblitz commented Apr 22, 2020

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 mercyblitz added this to the 2.7.7 milestone Apr 22, 2020
@mercyblitz mercyblitz self-assigned this Apr 22, 2020
@CodeIngL
Copy link

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

mercyblitz added a commit to mercyblitz/dubbo that referenced this issue Apr 23, 2020
…nfig BeanDefinitions in XML configuration
mercyblitz added a commit to mercyblitz/dubbo that referenced this issue Apr 23, 2020
…nfig BeanDefinitions in XML configuration
mercyblitz added a commit to mercyblitz/dubbo that referenced this issue Apr 24, 2020
…nfig BeanDefinitions in XML configuration
mercyblitz added a commit to mercyblitz/dubbo that referenced this issue Apr 24, 2020
…o.experimental.bean-definition-parser" to switch the new implementations on or not.
@mercyblitz
Copy link
Contributor Author

我认为重构他不是一个好主意,这是一个稳定的代遗弃的的模块。唯一的瑕疵只是众多普通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 added a commit to mercyblitz/dubbo that referenced this issue Apr 26, 2020
…o.experimental.bean-definition-parser" to switch the new implementations on or not.
@evil0th
Copy link

evil0th commented May 19, 2020

@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

@Da-Hong
Copy link

Da-Hong commented Jul 6, 2020

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

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

@Da-Hong
Copy link

Da-Hong commented Jul 7, 2020

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

@CodeIngL
Copy link

CodeIngL commented Jul 7, 2020

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

@Da-Hong
Copy link

Da-Hong commented Jul 7, 2020

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

方便讲下解决方案吗?

@CodeIngL
Copy link

CodeIngL commented Jul 8, 2020

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

@CodeIngL
Copy link

CodeIngL commented Jul 8, 2020

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

@Da-Hong
Copy link

Da-Hong commented Jul 8, 2020

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

@furaul
Copy link

furaul commented Dec 1, 2020

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

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

@CodeIngL
Copy link

CodeIngL commented Dec 1, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants