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

refactor(apollo-biz): Use constructor injection instead of field injection #4826

Merged
merged 93 commits into from
Apr 4, 2023

Conversation

klboke
Copy link
Contributor

@klboke klboke commented Mar 30, 2023

What's the purpose of this PR

  • refactor(apollo-biz): Use constructor injection instead of field injection

motivation

This patch uses Constructor Injection to avoid the drawbacks of Field Injection. What's more, Spring Documentation also recommends using Constructor Injection here

Here are some of the drawbacks of Field Injection listed in this article:

Disallows immutable field declaration

Eases single responsibility principle violation

Tightly coupled with dependency injection container

Hidden dependencies

klboke and others added 30 commits May 16, 2019 11:07
@klboke klboke requested review from mghio and nobodyiam March 30, 2023 09:06
@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

Merging #4826 (4cbc8dc) into master (11303c7) will increase coverage by 0.25%.
The diff coverage is 85.50%.

@@             Coverage Diff              @@
##             master    #4826      +/-   ##
============================================
+ Coverage     48.16%   48.41%   +0.25%     
- Complexity     1719     1721       +2     
============================================
  Files           346      346              
  Lines         10772    10819      +47     
  Branches       1076     1076              
============================================
+ Hits           5188     5238      +50     
+ Misses         5262     5259       -3     
  Partials        322      322              
Impacted Files Coverage Δ
...igservice/controller/NotificationControllerV2.java 86.61% <ø> (ø)
...k/apollo/portal/component/PermissionValidator.java 16.66% <ø> (ø)
...apollo/portal/controller/PermissionController.java 5.75% <ø> (ø)
...pollo/portal/service/SystemRoleManagerService.java 52.94% <ø> (ø)
...lo/portal/spi/configuration/AuthConfiguration.java 8.02% <0.00%> (-0.06%) ⬇️
...mework/apollo/portal/spi/ldap/LdapUserService.java 0.00% <0.00%> (ø)
...mework/apollo/biz/service/BizDBPropertySource.java 80.55% <50.00%> (-1.80%) ⬇️
.../apollo/portal/service/PortalDBPropertySource.java 31.57% <50.00%> (+2.16%) ⬆️
.../configservice/ConfigServiceAutoConfiguration.java 91.66% <84.61%> (-1.67%) ⬇️
...lo/biz/grayReleaseRule/GrayReleaseRulesHolder.java 73.01% <100.00%> (+0.43%) ⬆️
... and 9 more

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@nobodyiam
Copy link
Member

Please also help to fix the conflict.

ZhangJian He and others added 6 commits April 3, 2023 10:13
…polloconfig#4823)

* add tech-support-qq-4.png

* Update README.md

* Enhance the user experience in the scenario of submitting duplicate keys

* Modify the key-value conflict exception prompt, adjust the code style

* test(apollo-biz): Correct the test semantics of the test case in ItemSetControllerTest

* test(apollo-biz): Optimize the test case for ItemSetControllerTest

* test(apollo-biz): Optimize the test case for ItemSetControllerTest

* test(apollo-biz): Optimize the test case for ItemSetControllerTest

---------

Co-authored-by: Jason Song <[email protected]>
* add tech-support-qq-4.png

* Update README.md

* Enhance the user experience in the scenario of submitting duplicate keys

* Modify the key-value conflict exception prompt, adjust the code style

* refactor(apollo-biz): Refactor the code related to ReleaseMessage

* refactor(apollo-biz): Refactor the code related to ReleaseMessage

* test(apollo-admin): Optimize the test case

* test(apollo-admin): Optimize the test case

---------

Co-authored-by: Jason Song <[email protected]>
@klboke
Copy link
Contributor Author

klboke commented Apr 3, 2023

Please also help to fix the conflict.

ok

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

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

LGTM

@nobodyiam nobodyiam merged commit 2800a00 into apolloconfig:master Apr 4, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Apr 4, 2023
@klboke klboke deleted the kl-autowired branch April 4, 2023 02:41
@nobodyiam nobodyiam added this to the 2.2.0 milestone Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants