-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
[Dubbo-5049]support @Bean on Config class to config id as alias #5063
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5063 +/- ##
===========================================
- Coverage 63.98% 63.29% -0.7%
+ Complexity 452 449 -3
===========================================
Files 769 790 +21
Lines 33206 35042 +1836
Branches 5237 5480 +243
===========================================
+ Hits 21248 22180 +932
- Misses 9533 10328 +795
- Partials 2425 2534 +109
Continue to review full report at Codecov.
|
181bc86
to
964e1df
Compare
04ba82b
to
143733f
Compare
… config bean. Fixes apache#5049
143733f
to
c5cfcec
Compare
The PR have not solved my issue. When user defined ProtocolConfig as a spring bean , service annotation cannot get the dubbo bean id.
I've tried your solution in my local, still not able to get dubbo bean id.
|
Can you provider a GitHub address which can reproduce this? |
as #5049 mentioned, when
@Service(protocol = "dubbo1")
is annotated on a class, the provider starts failed,dubbo1
is theid
property ofProtocolConfig
.The failure cause is
dubbo1
is not an name or alias ofProtocolConfig
bean.When using xml way:
xml config with
id
property assigned withdubbo1
, the provider starts successfully.I think the annotation way should work fine as well.
My suggestion approach
Use spring extension interfaces, such as:
1
after config beans's initialization by implementing methodpostProcessAfterInitialization
, which is already implemented by classDubboConfigBindingBeanPostProcessor
with an empty method.Actually, @haiyang1985 has a PR #5051 solving this issue:
But I think using
getBean
inpostProcessBeanDefinitionRegistry
method cause the initialization of ProtocolConfig's bean too early (bean registry phase in spring) as @mercyblitz mentioned