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

Bugfix - ExtensionLoader can not inject by type properly. #9187

Merged
merged 10 commits into from Feb 6, 2022

Conversation

warmonipa
Copy link

@warmonipa warmonipa commented Nov 2, 2021

Fix #9150
Fix ExtensionLoader can not inject by type properly

What is the purpose of the change

Let ExtensionLoader support inject by type.

Brief changelog

  1. To add @Inject annotation replaces with the less generic and convenient @DisableInject annotation.
  2. The method injectExtension of ExtensionLoader can inject by type now.

Verifying this change

ExtensionLoader can inject by type, for instance, custom filter has setter method and inject
dependencies by type via annotation it with @Inject(type = ByType).

Checklist

  • Make sure there is a GitHub_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Add some description to dubbo-website project if you are requesting to add a feature.
  • GitHub Actions works fine on your own branch.
  • If this contribution is large, please follow the Software Donation Guide.

@codecov-commenter
Copy link

codecov-commenter commented Nov 3, 2021

Codecov Report

Merging #9187 (4414ebb) into master (01a0d55) will increase coverage by 0.35%.
The diff coverage is 80.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #9187      +/-   ##
============================================
+ Coverage     60.51%   60.86%   +0.35%     
- Complexity      413      446      +33     
============================================
  Files          1100     1101       +1     
  Lines         44523    44535      +12     
  Branches       6479     6482       +3     
============================================
+ Hits          26943    27107     +164     
+ Misses        14619    14453     -166     
- Partials       2961     2975      +14     
Impacted Files Coverage Δ
...va/org/apache/dubbo/common/config/Environment.java 83.33% <ø> (ø)
...org/apache/dubbo/config/context/ConfigManager.java 81.28% <ø> (ø)
...ookeeper/ZookeeperDynamicConfigurationFactory.java 66.66% <ø> (ø)
...tore/zookeeper/ZookeeperMetadataReportFactory.java 100.00% <ø> (ø)
...o/registry/zookeeper/ZookeeperRegistryFactory.java 100.00% <ø> (ø)
...apache/dubbo/common/extension/ExtensionLoader.java 80.41% <76.47%> (-0.48%) ⬇️
...java/org/apache/dubbo/common/extension/Inject.java 100.00% <100.00%> (ø)
...he/dubbo/remoting/transport/netty/NettyServer.java 70.17% <0.00%> (-3.51%) ⬇️
...ting/zookeeper/curator/CuratorZookeeperClient.java 67.79% <0.00%> (-1.13%) ⬇️
...dubbo/remoting/exchange/support/DefaultFuture.java 88.28% <0.00%> (-0.91%) ⬇️
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 01a0d55...4414ebb. Read the comment docs.

Copy link
Member

@wangchengming666 wangchengming666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

refactor DisableInject Annotation to the generic Inject Annotation.
@warmonipa warmonipa changed the title bugfix ExtensionLoader can not inject by type properly. Bugfix - ExtensionLoader can not inject by type properly. Jan 20, 2022
@warmonipa warmonipa requested a review from kylixs January 25, 2022 09:34
Copy link
Author

@warmonipa warmonipa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review

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

Successfully merging this pull request may close these issues.

None yet

5 participants