You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/12/13 06:38:30 UTC

[GitHub] [dubbo] gitchenjh opened a new pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor problem

gitchenjh opened a new pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397


   ## What is the purpose of the change
   fix #9370 
   
   ## Brief changelog
   fix `DubboConfigEarlyInitializationPostProcessor` counted as BeanPostProcess twice in `PostProcessorRegistrationDelegate.registerBeanPostProcessors()`
   
   ## Verifying this change
   
   ### before
   ![image](https://user-images.githubusercontent.com/24949156/145362738-f36913a0-679d-4148-be84-c8657f700194.png)
   
   `DubboConfigEarlyInitializationPostProcessor` in `beanFactory.getBeanPostProcessors()` and `postProcessorNames`
   The `beanProcessorTargetCount` is 17
   After registration the `beanFactory.getBeanPostProcessors()` should be 16
   
   ### after
   ![image](https://user-images.githubusercontent.com/24949156/145362667-b6c89c43-7cb6-4178-81d3-b44ebd0eee3c.png)
   No more `dubboConfigEarlyInitializationPostProcessor` in `postProcessorNames`
   The `beanProcessorTargetCount` is 16,
   After registration the `beanFactory.getBeanPostProcessors()` should be 16
   
   
   <!-- Follow this checklist to help us incorporate your contribution quickly and easily: -->
   
   ## Checklist
   - [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) 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.
   - [x] Each commit in the pull request should have a meaningful subject line and body.
   - [x] 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](https://github.com/apache/dubbo-samples) project.
   - [ ] Add some description to [dubbo-website](https://github.com/apache/dubbo-website) project if you are requesting to add a feature.
   - [x] GitHub Actions works fine on your own branch.
   - [ ] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/dubbo/wiki/Software-donation-guide).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] codecov-commenter edited a comment on pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor registered twice in Spring-Framework

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397#issuecomment-994252036


   # [Codecov](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#9397](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (586e65b) into [master](https://codecov.io/gh/apache/dubbo/commit/7cb6bff60598ff6729f6cf7eab46775f2b4ad305?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7cb6bff) will **decrease** coverage by `0.00%`.
   > The diff coverage is `50.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo/pull/9397/graphs/tree.svg?width=650&height=150&src=pr&token=VnEIkiFQT0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #9397      +/-   ##
   ============================================
   - Coverage     60.85%   60.85%   -0.01%     
   + Complexity      448      447       -1     
   ============================================
     Files          1100     1100              
     Lines         44507    44509       +2     
     Branches       6473     6475       +2     
   ============================================
     Hits          27086    27086              
   + Misses        14454    14452       -2     
   - Partials       2967     2971       +4     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...fig/DubboConfigEarlyRegistrationPostProcessor.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1zcHJpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9zcHJpbmcvYmVhbnMvZmFjdG9yeS9jb25maWcvRHViYm9Db25maWdFYXJseVJlZ2lzdHJhdGlvblBvc3RQcm9jZXNzb3IuamF2YQ==) | `50.00% <50.00%> (ø)` | |
   | [...pache/dubbo/config/spring/util/DubboBeanUtils.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1zcHJpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9zcHJpbmcvdXRpbC9EdWJib0JlYW5VdGlscy5qYXZh) | `54.54% <50.00%> (ø)` | |
   | [...in/java/org/apache/dubbo/common/utils/JVMUtil.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vdXRpbHMvSlZNVXRpbC5qYXZh) | `81.13% <0.00%> (-11.33%)` | :arrow_down: |
   | [...g/apache/dubbo/remoting/p2p/support/FileGroup.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctcDJwL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy9wMnAvc3VwcG9ydC9GaWxlR3JvdXAuamF2YQ==) | `41.50% <0.00%> (-9.44%)` | :arrow_down: |
   | [...rg/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0R1YmJvQ29kZWMuamF2YQ==) | `70.53% <0.00%> (-3.58%)` | :arrow_down: |
   | [...port/identifier/BaseServiceMetadataIdentifier.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tbWV0YWRhdGEvZHViYm8tbWV0YWRhdGEtYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9tZXRhZGF0YS9yZXBvcnQvaWRlbnRpZmllci9CYXNlU2VydmljZU1ldGFkYXRhSWRlbnRpZmllci5qYXZh) | `57.14% <0.00%> (-3.58%)` | :arrow_down: |
   | [...mmon/serialize/kryo/utils/AbstractKryoFactory.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tc2VyaWFsaXphdGlvbi9kdWJiby1zZXJpYWxpemF0aW9uLWtyeW8vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbW1vbi9zZXJpYWxpemUva3J5by91dGlscy9BYnN0cmFjdEtyeW9GYWN0b3J5LmphdmE=) | `75.43% <0.00%> (-3.51%)` | :arrow_down: |
   | [...he/dubbo/remoting/transport/netty/NettyServer.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eVNlcnZlci5qYXZh) | `70.17% <0.00%> (-3.51%)` | :arrow_down: |
   | [...e/dubbo/remoting/transport/netty/NettyChannel.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eUNoYW5uZWwuamF2YQ==) | `55.68% <0.00%> (-3.41%)` | :arrow_down: |
   | [...ava/org/apache/dubbo/config/ServiceConfigBase.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb25maWcvU2VydmljZUNvbmZpZ0Jhc2UuamF2YQ==) | `57.83% <0.00%> (-1.21%)` | :arrow_down: |
   | ... and [19 more](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [7cb6bff...586e65b](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] codecov-commenter edited a comment on pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor registered twice in Spring-Framework

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397#issuecomment-994252036


   # [Codecov](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#9397](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (586e65b) into [master](https://codecov.io/gh/apache/dubbo/commit/7cb6bff60598ff6729f6cf7eab46775f2b4ad305?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7cb6bff) will **decrease** coverage by `0.78%`.
   > The diff coverage is `50.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo/pull/9397/graphs/tree.svg?width=650&height=150&src=pr&token=VnEIkiFQT0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #9397      +/-   ##
   ============================================
   - Coverage     60.85%   60.07%   -0.79%     
   + Complexity      448      447       -1     
   ============================================
     Files          1100     1100              
     Lines         44507    44509       +2     
     Branches       6473     6475       +2     
   ============================================
   - Hits          27086    26739     -347     
   - Misses        14454    14817     +363     
   + Partials       2967     2953      -14     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...fig/DubboConfigEarlyRegistrationPostProcessor.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1zcHJpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9zcHJpbmcvYmVhbnMvZmFjdG9yeS9jb25maWcvRHViYm9Db25maWdFYXJseVJlZ2lzdHJhdGlvblBvc3RQcm9jZXNzb3IuamF2YQ==) | `50.00% <50.00%> (ø)` | |
   | [...pache/dubbo/config/spring/util/DubboBeanUtils.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1zcHJpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9zcHJpbmcvdXRpbC9EdWJib0JlYW5VdGlscy5qYXZh) | `54.54% <50.00%> (ø)` | |
   | [...ookeeper/ZookeeperDynamicConfigurationFactory.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnY2VudGVyL2R1YmJvLWNvbmZpZ2NlbnRlci16b29rZWVwZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZ2NlbnRlci9zdXBwb3J0L3pvb2tlZXBlci9ab29rZWVwZXJEeW5hbWljQ29uZmlndXJhdGlvbkZhY3RvcnkuamF2YQ==) | `0.00% <0.00%> (-66.67%)` | :arrow_down: |
   | [...gcenter/wrapper/CompositeDynamicConfiguration.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vY29uZmlnL2NvbmZpZ2NlbnRlci93cmFwcGVyL0NvbXBvc2l0ZUR5bmFtaWNDb25maWd1cmF0aW9uLmphdmE=) | `0.00% <0.00%> (-63.34%)` | :arrow_down: |
   | [...pport/zookeeper/ZookeeperDynamicConfiguration.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnY2VudGVyL2R1YmJvLWNvbmZpZ2NlbnRlci16b29rZWVwZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZ2NlbnRlci9zdXBwb3J0L3pvb2tlZXBlci9ab29rZWVwZXJEeW5hbWljQ29uZmlndXJhdGlvbi5qYXZh) | `0.00% <0.00%> (-60.00%)` | :arrow_down: |
   | [...a/org/apache/dubbo/rpc/filter/AccessLogFilter.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JwYy9maWx0ZXIvQWNjZXNzTG9nRmlsdGVyLmphdmE=) | `28.35% <0.00%> (-50.75%)` | :arrow_down: |
   | [...fig/configcenter/TreePathDynamicConfiguration.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vY29uZmlnL2NvbmZpZ2NlbnRlci9UcmVlUGF0aER5bmFtaWNDb25maWd1cmF0aW9uLmphdmE=) | `31.42% <0.00%> (-48.58%)` | :arrow_down: |
   | [.../dubbo/metadata/report/MetadataReportInstance.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tbWV0YWRhdGEvZHViYm8tbWV0YWRhdGEtYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9tZXRhZGF0YS9yZXBvcnQvTWV0YWRhdGFSZXBvcnRJbnN0YW5jZS5qYXZh) | `12.50% <0.00%> (-40.63%)` | :arrow_down: |
   | [...va/org/apache/dubbo/rpc/support/AccessLogData.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JwYy9zdXBwb3J0L0FjY2Vzc0xvZ0RhdGEuamF2YQ==) | `53.16% <0.00%> (-37.98%)` | :arrow_down: |
   | [.../configcenter/support/zookeeper/CacheListener.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnY2VudGVyL2R1YmJvLWNvbmZpZ2NlbnRlci16b29rZWVwZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZ2NlbnRlci9zdXBwb3J0L3pvb2tlZXBlci9DYWNoZUxpc3RlbmVyLmphdmE=) | `0.00% <0.00%> (-32.44%)` | :arrow_down: |
   | ... and [50 more](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [7cb6bff...586e65b](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] gitchenjh commented on a change in pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor registered twice in Spring Framework

Posted by GitBox <gi...@apache.org>.
gitchenjh commented on a change in pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397#discussion_r769337505



##########
File path: dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/config/DubboConfigEarlyRegistrationPostProcessor.java
##########
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.config.spring.beans.factory.config;
+
+import org.apache.dubbo.config.AbstractConfig;
+import org.apache.dubbo.config.context.ConfigManager;
+
+import com.alibaba.spring.beans.factory.config.GenericBeanPostProcessorAdapter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.core.PriorityOrdered;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * Generally, {@link AbstractConfig Dubbo Config} Bean will be added into {@link ConfigManager} on the bean initialization
+ * life cycle through {@link CommonAnnotationBeanPostProcessor} executing the callback of
+ * {@link PostConstruct @PostConstruct}. However, the instantiation and initialization of
+ * {@link AbstractConfig Dubbo Config} Bean could be too early before {@link CommonAnnotationBeanPostProcessor}, e.g,
+ * execution, thus it's required to register the {@link DubboConfigEarlyInitializationPostProcessor
+ * DubboConfigEarlyInitializationPostProcessor} instance as a {@link BeanPostProcessor} into
+ * {@link DefaultListableBeanFactory the BeanFatory} using {@link BeanDefinitionRegistryPostProcessor} as early as
+ * possible.
+ *
+ * @author <a href="mailto:842761733@qq.com">chenjh</a>
+ * @see DubboConfigEarlyInitializationPostProcessor
+ * @since 2.7.15
+ */
+public class DubboConfigEarlyRegistrationPostProcessor implements BeanDefinitionRegistryPostProcessor, PriorityOrdered {
+
+    public static final String BEAN_NAME = "dubboConfigEarlyRegistrationPostProcessor";
+
+    private static final Log logger = LogFactory.getLog(DubboConfigEarlyRegistrationPostProcessor.class.getName());
+
+    private DefaultListableBeanFactory beanFactory;
+
+    private DubboConfigEarlyInitializationPostProcessor configEarlyInitializationPostProcessor =
+            new DubboConfigEarlyInitializationPostProcessor();
+
+    @Override
+    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
+        this.beanFactory = unwrap(registry);
+        registryConfigEarlyInitializationPostProcessor(beanFactory);
+    }
+
+    @Override
+    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
+        if (this.beanFactory == null) { // try again if postProcessBeanDefinitionRegistry method does not effect.
+            this.beanFactory = unwrap(beanFactory);
+            registryConfigEarlyInitializationPostProcessor(this.beanFactory);
+        }
+    }
+
+    @Override
+    public int getOrder() {
+        return HIGHEST_PRECEDENCE;
+    }
+
+    /**
+     * Register DubboConfigEarlyInitializationPostProcessor as BeanPostProcessor manually
+     * before {@link AbstractApplicationContext#registerBeanPostProcessors(ConfigurableListableBeanFactory)
+     * Spring Framework automatically register}
+     */
+    private void registryConfigEarlyInitializationPostProcessor(DefaultListableBeanFactory beanFactory) {
+        if (beanFactory != null) {
+            // Register DubboConfigEarlyInitializationPostProcessor
+            beanFactory.addBeanPostProcessor(configEarlyInitializationPostProcessor);
+            if (logger.isInfoEnabled()) {
+                logger.info("DubboConfigEarlyInitializationPostProcessor has bean registered");
+            }
+        }
+    }
+
+    private DefaultListableBeanFactory unwrap(Object registry) {
+        if (registry instanceof DefaultListableBeanFactory) {
+            return (DefaultListableBeanFactory) registry;
+        }
+        return null;
+    }
+
+    class DubboConfigEarlyInitializationPostProcessor extends GenericBeanPostProcessorAdapter<AbstractConfig> {
+
+        protected void processBeforeInitialization(AbstractConfig config, String beanName) throws BeansException {
+            if (beanFactory == null) {
+                if (logger.isErrorEnabled()) {
+                    logger.error("Current Processor is not running in Spring container, next action will be skipped!");
+                }
+                return;
+            }
+
+            // If CommonAnnotationBeanPostProcessor is already registered,  the method addIntoConfigManager()
+            // will be invoked in Bean life cycle.
+            if (!hasRegisteredCommonAnnotationBeanPostProcessor()) {
+                if (logger.isWarnEnabled()) {
+                    logger.warn("CommonAnnotationBeanPostProcessor is not registered yet, " +
+                            "the method addIntoConfigManager() will be invoked directly");
+                }
+                config.addIntoConfigManager();
+            }
+        }
+
+        /**
+         * {@link DefaultListableBeanFactory} has registered {@link CommonAnnotationBeanPostProcessor} or not?
+         *
+         * @return if registered, return <code>true</code>, or <code>false</code>
+         */
+        private boolean hasRegisteredCommonAnnotationBeanPostProcessor() {
+            for (BeanPostProcessor beanPostProcessor : beanFactory.getBeanPostProcessors()) {
+                if (CommonAnnotationBeanPostProcessor.class.equals(beanPostProcessor.getClass())) {
+                    return true;
+                }
+            }
+            return false;
+        }

Review comment:
       new PR #9414




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] gitchenjh commented on a change in pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor registered twice in Spring Framework

Posted by GitBox <gi...@apache.org>.
gitchenjh commented on a change in pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397#discussion_r769337199



##########
File path: dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/config/DubboConfigEarlyRegistrationPostProcessor.java
##########
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.config.spring.beans.factory.config;
+
+import org.apache.dubbo.config.AbstractConfig;
+import org.apache.dubbo.config.context.ConfigManager;
+
+import com.alibaba.spring.beans.factory.config.GenericBeanPostProcessorAdapter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.core.PriorityOrdered;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * Generally, {@link AbstractConfig Dubbo Config} Bean will be added into {@link ConfigManager} on the bean initialization
+ * life cycle through {@link CommonAnnotationBeanPostProcessor} executing the callback of
+ * {@link PostConstruct @PostConstruct}. However, the instantiation and initialization of
+ * {@link AbstractConfig Dubbo Config} Bean could be too early before {@link CommonAnnotationBeanPostProcessor}, e.g,
+ * execution, thus it's required to register the {@link DubboConfigEarlyInitializationPostProcessor
+ * DubboConfigEarlyInitializationPostProcessor} instance as a {@link BeanPostProcessor} into
+ * {@link DefaultListableBeanFactory the BeanFatory} using {@link BeanDefinitionRegistryPostProcessor} as early as
+ * possible.
+ *
+ * @author <a href="mailto:842761733@qq.com">chenjh</a>
+ * @see DubboConfigEarlyInitializationPostProcessor
+ * @since 2.7.15
+ */
+public class DubboConfigEarlyRegistrationPostProcessor implements BeanDefinitionRegistryPostProcessor, PriorityOrdered {
+
+    public static final String BEAN_NAME = "dubboConfigEarlyRegistrationPostProcessor";
+
+    private static final Log logger = LogFactory.getLog(DubboConfigEarlyRegistrationPostProcessor.class.getName());
+
+    private DefaultListableBeanFactory beanFactory;
+
+    private DubboConfigEarlyInitializationPostProcessor configEarlyInitializationPostProcessor =
+            new DubboConfigEarlyInitializationPostProcessor();
+
+    @Override
+    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
+        this.beanFactory = unwrap(registry);
+        registryConfigEarlyInitializationPostProcessor(beanFactory);
+    }
+
+    @Override
+    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
+        if (this.beanFactory == null) { // try again if postProcessBeanDefinitionRegistry method does not effect.
+            this.beanFactory = unwrap(beanFactory);
+            registryConfigEarlyInitializationPostProcessor(this.beanFactory);
+        }
+    }
+
+    @Override
+    public int getOrder() {
+        return HIGHEST_PRECEDENCE;
+    }
+
+    /**
+     * Register DubboConfigEarlyInitializationPostProcessor as BeanPostProcessor manually
+     * before {@link AbstractApplicationContext#registerBeanPostProcessors(ConfigurableListableBeanFactory)
+     * Spring Framework automatically register}
+     */
+    private void registryConfigEarlyInitializationPostProcessor(DefaultListableBeanFactory beanFactory) {
+        if (beanFactory != null) {
+            // Register DubboConfigEarlyInitializationPostProcessor
+            beanFactory.addBeanPostProcessor(configEarlyInitializationPostProcessor);
+            if (logger.isInfoEnabled()) {
+                logger.info("DubboConfigEarlyInitializationPostProcessor has bean registered");
+            }
+        }
+    }
+
+    private DefaultListableBeanFactory unwrap(Object registry) {
+        if (registry instanceof DefaultListableBeanFactory) {
+            return (DefaultListableBeanFactory) registry;
+        }
+        return null;
+    }
+
+    class DubboConfigEarlyInitializationPostProcessor extends GenericBeanPostProcessorAdapter<AbstractConfig> {
+
+        protected void processBeforeInitialization(AbstractConfig config, String beanName) throws BeansException {
+            if (beanFactory == null) {
+                if (logger.isErrorEnabled()) {
+                    logger.error("Current Processor is not running in Spring container, next action will be skipped!");
+                }
+                return;
+            }
+
+            // If CommonAnnotationBeanPostProcessor is already registered,  the method addIntoConfigManager()
+            // will be invoked in Bean life cycle.
+            if (!hasRegisteredCommonAnnotationBeanPostProcessor()) {
+                if (logger.isWarnEnabled()) {
+                    logger.warn("CommonAnnotationBeanPostProcessor is not registered yet, " +
+                            "the method addIntoConfigManager() will be invoked directly");
+                }
+                config.addIntoConfigManager();
+            }
+        }
+
+        /**
+         * {@link DefaultListableBeanFactory} has registered {@link CommonAnnotationBeanPostProcessor} or not?
+         *
+         * @return if registered, return <code>true</code>, or <code>false</code>
+         */
+        private boolean hasRegisteredCommonAnnotationBeanPostProcessor() {
+            for (BeanPostProcessor beanPostProcessor : beanFactory.getBeanPostProcessors()) {
+                if (CommonAnnotationBeanPostProcessor.class.equals(beanPostProcessor.getClass())) {
+                    return true;
+                }
+            }
+            return false;
+        }

Review comment:
       > It's better to cache the result if has found CommonAnnotationBeanPostProcessor
   
   Thanks for your reply. I can't cache  the result all the time. Here is my reason:
   There might be some BeanPostProcessors not instantiated before some Dubbo Config Bean instantiated (which will call this method),so the  result of `beanFactory.getBeanPostProcessors()` may not be the same when this method is called.     
   But, it can be cached after CommonAnnotationBeanPostProcessor instantiated,  I will submit another PR.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] codecov-commenter commented on pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor registered twice in Spring-Framework

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397#issuecomment-994252036


   # [Codecov](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#9397](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (586e65b) into [master](https://codecov.io/gh/apache/dubbo/commit/7cb6bff60598ff6729f6cf7eab46775f2b4ad305?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7cb6bff) will **decrease** coverage by `0.81%`.
   > The diff coverage is `50.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo/pull/9397/graphs/tree.svg?width=650&height=150&src=pr&token=VnEIkiFQT0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #9397      +/-   ##
   ============================================
   - Coverage     60.85%   60.04%   -0.82%     
   + Complexity      448      446       -2     
   ============================================
     Files          1100     1100              
     Lines         44507    44462      -45     
     Branches       6473     6443      -30     
   ============================================
   - Hits          27086    26695     -391     
   - Misses        14454    14820     +366     
   + Partials       2967     2947      -20     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...fig/DubboConfigEarlyRegistrationPostProcessor.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1zcHJpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9zcHJpbmcvYmVhbnMvZmFjdG9yeS9jb25maWcvRHViYm9Db25maWdFYXJseVJlZ2lzdHJhdGlvblBvc3RQcm9jZXNzb3IuamF2YQ==) | `50.00% <50.00%> (ø)` | |
   | [...pache/dubbo/config/spring/util/DubboBeanUtils.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1zcHJpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9zcHJpbmcvdXRpbC9EdWJib0JlYW5VdGlscy5qYXZh) | `54.54% <50.00%> (ø)` | |
   | [...ookeeper/ZookeeperDynamicConfigurationFactory.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnY2VudGVyL2R1YmJvLWNvbmZpZ2NlbnRlci16b29rZWVwZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZ2NlbnRlci9zdXBwb3J0L3pvb2tlZXBlci9ab29rZWVwZXJEeW5hbWljQ29uZmlndXJhdGlvbkZhY3RvcnkuamF2YQ==) | `0.00% <0.00%> (-66.67%)` | :arrow_down: |
   | [...gcenter/wrapper/CompositeDynamicConfiguration.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vY29uZmlnL2NvbmZpZ2NlbnRlci93cmFwcGVyL0NvbXBvc2l0ZUR5bmFtaWNDb25maWd1cmF0aW9uLmphdmE=) | `0.00% <0.00%> (-63.34%)` | :arrow_down: |
   | [...pport/zookeeper/ZookeeperDynamicConfiguration.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnY2VudGVyL2R1YmJvLWNvbmZpZ2NlbnRlci16b29rZWVwZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZ2NlbnRlci9zdXBwb3J0L3pvb2tlZXBlci9ab29rZWVwZXJEeW5hbWljQ29uZmlndXJhdGlvbi5qYXZh) | `0.00% <0.00%> (-60.00%)` | :arrow_down: |
   | [...a/org/apache/dubbo/rpc/filter/AccessLogFilter.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JwYy9maWx0ZXIvQWNjZXNzTG9nRmlsdGVyLmphdmE=) | `28.35% <0.00%> (-50.75%)` | :arrow_down: |
   | [...fig/configcenter/TreePathDynamicConfiguration.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vY29uZmlnL2NvbmZpZ2NlbnRlci9UcmVlUGF0aER5bmFtaWNDb25maWd1cmF0aW9uLmphdmE=) | `31.42% <0.00%> (-48.58%)` | :arrow_down: |
   | [.../dubbo/metadata/report/MetadataReportInstance.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tbWV0YWRhdGEvZHViYm8tbWV0YWRhdGEtYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9tZXRhZGF0YS9yZXBvcnQvTWV0YWRhdGFSZXBvcnRJbnN0YW5jZS5qYXZh) | `12.50% <0.00%> (-40.63%)` | :arrow_down: |
   | [...va/org/apache/dubbo/rpc/support/AccessLogData.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JwYy9zdXBwb3J0L0FjY2Vzc0xvZ0RhdGEuamF2YQ==) | `53.16% <0.00%> (-37.98%)` | :arrow_down: |
   | [.../configcenter/support/zookeeper/CacheListener.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnY2VudGVyL2R1YmJvLWNvbmZpZ2NlbnRlci16b29rZWVwZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZ2NlbnRlci9zdXBwb3J0L3pvb2tlZXBlci9DYWNoZUxpc3RlbmVyLmphdmE=) | `0.00% <0.00%> (-32.44%)` | :arrow_down: |
   | ... and [72 more](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [7cb6bff...586e65b](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] kylixs commented on a change in pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor problem

Posted by GitBox <gi...@apache.org>.
kylixs commented on a change in pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397#discussion_r768610463



##########
File path: dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/config/DubboConfigEarlyInitializationPostProcessor.java
##########
@@ -45,27 +42,27 @@
  * @see GenericBeanPostProcessorAdapter
  * @since 2.7.9
  */
-public class DubboConfigEarlyInitializationPostProcessor extends GenericBeanPostProcessorAdapter<AbstractConfig>
-        implements BeanDefinitionRegistryPostProcessor, PriorityOrdered {
+public class DubboConfigEarlyInitializationPostProcessor extends GenericBeanPostProcessorAdapter<AbstractConfig> {
 
     private static final Log logger = LogFactory.getLog(DubboConfigEarlyInitializationPostProcessor.class.getName());
 
-    public static final String BEAN_NAME = "dubboConfigEarlyInitializationPostProcessor";
+    private static DubboConfigEarlyInitializationPostProcessor SINGLETON;
 
     private DefaultListableBeanFactory beanFactory;
 
-    @Override
-    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
-        this.beanFactory = unwrap(registry);
-        initBeanFactory();
+    private DubboConfigEarlyInitializationPostProcessor(DefaultListableBeanFactory beanFactory) {
+        this.beanFactory = beanFactory;
     }
 
-    @Override
-    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
-        if (beanFactory == null) { // try again if postProcessBeanDefinitionRegistry method does not effect.
-            this.beanFactory = unwrap(beanFactory);
-            initBeanFactory();
+    public static DubboConfigEarlyInitializationPostProcessor getSingleton(DefaultListableBeanFactory beanFactory) {

Review comment:
       I think the DubboConfigEarlyInitializationPostProcessor can be changed to a inner class of DubboConfigEarlyRegistrationPostProcessor,  it's managed by DubboConfigEarlyRegistrationPostProcessor.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] codecov-commenter edited a comment on pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor registered twice in Spring-Framework

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397#issuecomment-994252036


   # [Codecov](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#9397](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (586e65b) into [master](https://codecov.io/gh/apache/dubbo/commit/7cb6bff60598ff6729f6cf7eab46775f2b4ad305?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7cb6bff) will **decrease** coverage by `0.02%`.
   > The diff coverage is `50.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo/pull/9397/graphs/tree.svg?width=650&height=150&src=pr&token=VnEIkiFQT0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #9397      +/-   ##
   ============================================
   - Coverage     60.85%   60.83%   -0.03%     
   + Complexity      448      447       -1     
   ============================================
     Files          1100     1100              
     Lines         44507    44509       +2     
     Branches       6473     6475       +2     
   ============================================
   - Hits          27086    27077       -9     
   - Misses        14454    14459       +5     
   - Partials       2967     2973       +6     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...fig/DubboConfigEarlyRegistrationPostProcessor.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1zcHJpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9zcHJpbmcvYmVhbnMvZmFjdG9yeS9jb25maWcvRHViYm9Db25maWdFYXJseVJlZ2lzdHJhdGlvblBvc3RQcm9jZXNzb3IuamF2YQ==) | `50.00% <50.00%> (ø)` | |
   | [...pache/dubbo/config/spring/util/DubboBeanUtils.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1zcHJpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9zcHJpbmcvdXRpbC9EdWJib0JlYW5VdGlscy5qYXZh) | `54.54% <50.00%> (ø)` | |
   | [...in/java/org/apache/dubbo/common/utils/JVMUtil.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vdXRpbHMvSlZNVXRpbC5qYXZh) | `81.13% <0.00%> (-11.33%)` | :arrow_down: |
   | [...g/apache/dubbo/remoting/p2p/support/FileGroup.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctcDJwL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy9wMnAvc3VwcG9ydC9GaWxlR3JvdXAuamF2YQ==) | `41.50% <0.00%> (-9.44%)` | :arrow_down: |
   | [...port/identifier/BaseServiceMetadataIdentifier.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tbWV0YWRhdGEvZHViYm8tbWV0YWRhdGEtYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9tZXRhZGF0YS9yZXBvcnQvaWRlbnRpZmllci9CYXNlU2VydmljZU1ldGFkYXRhSWRlbnRpZmllci5qYXZh) | `53.57% <0.00%> (-7.15%)` | :arrow_down: |
   | [...rg/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0R1YmJvQ29kZWMuamF2YQ==) | `70.53% <0.00%> (-3.58%)` | :arrow_down: |
   | [...mmon/serialize/kryo/utils/AbstractKryoFactory.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tc2VyaWFsaXphdGlvbi9kdWJiby1zZXJpYWxpemF0aW9uLWtyeW8vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbW1vbi9zZXJpYWxpemUva3J5by91dGlscy9BYnN0cmFjdEtyeW9GYWN0b3J5LmphdmE=) | `75.43% <0.00%> (-3.51%)` | :arrow_down: |
   | [...he/dubbo/remoting/transport/netty/NettyServer.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eVNlcnZlci5qYXZh) | `70.17% <0.00%> (-3.51%)` | :arrow_down: |
   | [...e/dubbo/remoting/transport/netty/NettyChannel.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eUNoYW5uZWwuamF2YQ==) | `55.68% <0.00%> (-3.41%)` | :arrow_down: |
   | [...etadata/report/support/AbstractMetadataReport.java](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tbWV0YWRhdGEvZHViYm8tbWV0YWRhdGEtYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9tZXRhZGF0YS9yZXBvcnQvc3VwcG9ydC9BYnN0cmFjdE1ldGFkYXRhUmVwb3J0LmphdmE=) | `56.31% <0.00%> (-3.40%)` | :arrow_down: |
   | ... and [21 more](https://codecov.io/gh/apache/dubbo/pull/9397/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [7cb6bff...586e65b](https://codecov.io/gh/apache/dubbo/pull/9397?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] kylixs commented on a change in pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor problem

Posted by GitBox <gi...@apache.org>.
kylixs commented on a change in pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397#discussion_r768602564



##########
File path: dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/config/DubboConfigEarlyRegistrationPostProcessor.java
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.config.spring.beans.factory.config;
+
+import org.apache.dubbo.config.AbstractConfig;
+import org.apache.dubbo.config.context.ConfigManager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
+import org.springframework.core.PriorityOrdered;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * Generally, {@link AbstractConfig Dubbo Config} Bean will be added into {@link ConfigManager} on the bean initialization
+ * life cycle through {@link CommonAnnotationBeanPostProcessor} executing the callback of
+ * {@link PostConstruct @PostConstruct}. However, the instantiation and initialization of
+ * {@link AbstractConfig Dubbo Config} Bean could be too early before {@link CommonAnnotationBeanPostProcessor}, e.g,
+ * execution, thus it's required to register the current instance as a {@link BeanPostProcessor} into
+ * {@link DefaultListableBeanFactory the BeanFatory} using {@link BeanDefinitionRegistryPostProcessor} as early as
+ * possible.
+ *
+ * @author <a href="mailto:842761733@qq.com">chenjh</a>
+ * @see DubboConfigEarlyInitializationPostProcessor
+ * @since 2.7.15
+ */
+public class DubboConfigEarlyRegistrationPostProcessor implements BeanDefinitionRegistryPostProcessor, PriorityOrdered {
+
+    public static final String BEAN_NAME = "dubboConfigEarlyRegistrationPostProcessor";
+
+    private static final Log logger = LogFactory.getLog(DubboConfigEarlyRegistrationPostProcessor.class.getName());
+
+    private DefaultListableBeanFactory beanFactory;
+
+    @Override
+    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
+        this.beanFactory = unwrap(registry);
+        initBeanFactory(beanFactory);
+    }
+
+    @Override
+    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
+        if (this.beanFactory == null) { // try again if postProcessBeanDefinitionRegistry method does not effect.
+            this.beanFactory = unwrap(beanFactory);
+            initBeanFactory(this.beanFactory);
+        }
+    }
+
+    @Override
+    public int getOrder() {
+        return HIGHEST_PRECEDENCE;
+    }
+
+    private void initBeanFactory(DefaultListableBeanFactory beanFactory) {
+        if (beanFactory != null) {
+            DubboConfigEarlyInitializationPostProcessor dceiPostProcessor =
+                    DubboConfigEarlyInitializationPostProcessor.getSingleton(beanFactory);
+            // Register itself
+            if (logger.isInfoEnabled()) {
+                logger.info("BeanFactory is about to be initialized, trying to resolve the Dubbo Config Beans early " +

Review comment:
       change this log message




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] kylixs commented on a change in pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor registered twice in Spring Framework

Posted by GitBox <gi...@apache.org>.
kylixs commented on a change in pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397#discussion_r769289966



##########
File path: dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/config/DubboConfigEarlyRegistrationPostProcessor.java
##########
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.config.spring.beans.factory.config;
+
+import org.apache.dubbo.config.AbstractConfig;
+import org.apache.dubbo.config.context.ConfigManager;
+
+import com.alibaba.spring.beans.factory.config.GenericBeanPostProcessorAdapter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.core.PriorityOrdered;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * Generally, {@link AbstractConfig Dubbo Config} Bean will be added into {@link ConfigManager} on the bean initialization
+ * life cycle through {@link CommonAnnotationBeanPostProcessor} executing the callback of
+ * {@link PostConstruct @PostConstruct}. However, the instantiation and initialization of
+ * {@link AbstractConfig Dubbo Config} Bean could be too early before {@link CommonAnnotationBeanPostProcessor}, e.g,
+ * execution, thus it's required to register the {@link DubboConfigEarlyInitializationPostProcessor
+ * DubboConfigEarlyInitializationPostProcessor} instance as a {@link BeanPostProcessor} into
+ * {@link DefaultListableBeanFactory the BeanFatory} using {@link BeanDefinitionRegistryPostProcessor} as early as
+ * possible.
+ *
+ * @author <a href="mailto:842761733@qq.com">chenjh</a>
+ * @see DubboConfigEarlyInitializationPostProcessor
+ * @since 2.7.15
+ */
+public class DubboConfigEarlyRegistrationPostProcessor implements BeanDefinitionRegistryPostProcessor, PriorityOrdered {
+
+    public static final String BEAN_NAME = "dubboConfigEarlyRegistrationPostProcessor";
+
+    private static final Log logger = LogFactory.getLog(DubboConfigEarlyRegistrationPostProcessor.class.getName());
+
+    private DefaultListableBeanFactory beanFactory;
+
+    private DubboConfigEarlyInitializationPostProcessor configEarlyInitializationPostProcessor =
+            new DubboConfigEarlyInitializationPostProcessor();
+
+    @Override
+    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
+        this.beanFactory = unwrap(registry);
+        registryConfigEarlyInitializationPostProcessor(beanFactory);
+    }
+
+    @Override
+    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
+        if (this.beanFactory == null) { // try again if postProcessBeanDefinitionRegistry method does not effect.
+            this.beanFactory = unwrap(beanFactory);
+            registryConfigEarlyInitializationPostProcessor(this.beanFactory);
+        }
+    }
+
+    @Override
+    public int getOrder() {
+        return HIGHEST_PRECEDENCE;
+    }
+
+    /**
+     * Register DubboConfigEarlyInitializationPostProcessor as BeanPostProcessor manually
+     * before {@link AbstractApplicationContext#registerBeanPostProcessors(ConfigurableListableBeanFactory)
+     * Spring Framework automatically register}
+     */
+    private void registryConfigEarlyInitializationPostProcessor(DefaultListableBeanFactory beanFactory) {
+        if (beanFactory != null) {
+            // Register DubboConfigEarlyInitializationPostProcessor
+            beanFactory.addBeanPostProcessor(configEarlyInitializationPostProcessor);
+            if (logger.isInfoEnabled()) {
+                logger.info("DubboConfigEarlyInitializationPostProcessor has bean registered");
+            }
+        }
+    }
+
+    private DefaultListableBeanFactory unwrap(Object registry) {
+        if (registry instanceof DefaultListableBeanFactory) {
+            return (DefaultListableBeanFactory) registry;
+        }
+        return null;
+    }
+
+    class DubboConfigEarlyInitializationPostProcessor extends GenericBeanPostProcessorAdapter<AbstractConfig> {
+
+        protected void processBeforeInitialization(AbstractConfig config, String beanName) throws BeansException {
+            if (beanFactory == null) {
+                if (logger.isErrorEnabled()) {
+                    logger.error("Current Processor is not running in Spring container, next action will be skipped!");
+                }
+                return;
+            }
+
+            // If CommonAnnotationBeanPostProcessor is already registered,  the method addIntoConfigManager()
+            // will be invoked in Bean life cycle.
+            if (!hasRegisteredCommonAnnotationBeanPostProcessor()) {
+                if (logger.isWarnEnabled()) {
+                    logger.warn("CommonAnnotationBeanPostProcessor is not registered yet, " +
+                            "the method addIntoConfigManager() will be invoked directly");
+                }
+                config.addIntoConfigManager();
+            }
+        }
+
+        /**
+         * {@link DefaultListableBeanFactory} has registered {@link CommonAnnotationBeanPostProcessor} or not?
+         *
+         * @return if registered, return <code>true</code>, or <code>false</code>
+         */
+        private boolean hasRegisteredCommonAnnotationBeanPostProcessor() {
+            for (BeanPostProcessor beanPostProcessor : beanFactory.getBeanPostProcessors()) {
+                if (CommonAnnotationBeanPostProcessor.class.equals(beanPostProcessor.getClass())) {
+                    return true;
+                }
+            }
+            return false;
+        }

Review comment:
       It's better to cache the result if has found CommonAnnotationBeanPostProcessor




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] chickenlj merged pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor registered twice in Spring Framework

Posted by GitBox <gi...@apache.org>.
chickenlj merged pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] kylixs commented on a change in pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor problem

Posted by GitBox <gi...@apache.org>.
kylixs commented on a change in pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397#discussion_r768602359



##########
File path: dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/config/DubboConfigEarlyRegistrationPostProcessor.java
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.config.spring.beans.factory.config;
+
+import org.apache.dubbo.config.AbstractConfig;
+import org.apache.dubbo.config.context.ConfigManager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
+import org.springframework.core.PriorityOrdered;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * Generally, {@link AbstractConfig Dubbo Config} Bean will be added into {@link ConfigManager} on the bean initialization
+ * life cycle through {@link CommonAnnotationBeanPostProcessor} executing the callback of
+ * {@link PostConstruct @PostConstruct}. However, the instantiation and initialization of
+ * {@link AbstractConfig Dubbo Config} Bean could be too early before {@link CommonAnnotationBeanPostProcessor}, e.g,
+ * execution, thus it's required to register the current instance as a {@link BeanPostProcessor} into
+ * {@link DefaultListableBeanFactory the BeanFatory} using {@link BeanDefinitionRegistryPostProcessor} as early as
+ * possible.
+ *
+ * @author <a href="mailto:842761733@qq.com">chenjh</a>
+ * @see DubboConfigEarlyInitializationPostProcessor
+ * @since 2.7.15
+ */
+public class DubboConfigEarlyRegistrationPostProcessor implements BeanDefinitionRegistryPostProcessor, PriorityOrdered {
+
+    public static final String BEAN_NAME = "dubboConfigEarlyRegistrationPostProcessor";
+
+    private static final Log logger = LogFactory.getLog(DubboConfigEarlyRegistrationPostProcessor.class.getName());
+
+    private DefaultListableBeanFactory beanFactory;
+
+    @Override
+    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
+        this.beanFactory = unwrap(registry);
+        initBeanFactory(beanFactory);
+    }
+
+    @Override
+    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
+        if (this.beanFactory == null) { // try again if postProcessBeanDefinitionRegistry method does not effect.
+            this.beanFactory = unwrap(beanFactory);
+            initBeanFactory(this.beanFactory);
+        }
+    }
+
+    @Override
+    public int getOrder() {
+        return HIGHEST_PRECEDENCE;
+    }
+
+    private void initBeanFactory(DefaultListableBeanFactory beanFactory) {
+        if (beanFactory != null) {
+            DubboConfigEarlyInitializationPostProcessor dceiPostProcessor =
+                    DubboConfigEarlyInitializationPostProcessor.getSingleton(beanFactory);
+            // Register itself

Review comment:
       > // Register itself
   
   change this comment




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] kylixs commented on pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor problem

Posted by GitBox <gi...@apache.org>.
kylixs commented on pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397#issuecomment-993481860


   The root cause of the incorrect beanProcessorCount is that DubboConfigEarlyInitializationPostProcessor has been registered twice, once by manual registration and once by Spring automatic registration. A more elegant solution is to register only once, and there is no problem with registering in BeanDefinitionRegistryPostProcessor. It is best to explain its role more accurately in the javadoc.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] kylixs commented on a change in pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor problem

Posted by GitBox <gi...@apache.org>.
kylixs commented on a change in pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397#discussion_r768604510



##########
File path: dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/config/DubboConfigEarlyInitializationPostProcessor.java
##########
@@ -45,27 +42,27 @@
  * @see GenericBeanPostProcessorAdapter
  * @since 2.7.9
  */
-public class DubboConfigEarlyInitializationPostProcessor extends GenericBeanPostProcessorAdapter<AbstractConfig>
-        implements BeanDefinitionRegistryPostProcessor, PriorityOrdered {
+public class DubboConfigEarlyInitializationPostProcessor extends GenericBeanPostProcessorAdapter<AbstractConfig> {
 
     private static final Log logger = LogFactory.getLog(DubboConfigEarlyInitializationPostProcessor.class.getName());
 
-    public static final String BEAN_NAME = "dubboConfigEarlyInitializationPostProcessor";
+    private static DubboConfigEarlyInitializationPostProcessor SINGLETON;
 
     private DefaultListableBeanFactory beanFactory;
 
-    @Override
-    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
-        this.beanFactory = unwrap(registry);
-        initBeanFactory();
+    private DubboConfigEarlyInitializationPostProcessor(DefaultListableBeanFactory beanFactory) {
+        this.beanFactory = beanFactory;
     }
 
-    @Override
-    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
-        if (beanFactory == null) { // try again if postProcessBeanDefinitionRegistry method does not effect.
-            this.beanFactory = unwrap(beanFactory);
-            initBeanFactory();
+    public static DubboConfigEarlyInitializationPostProcessor getSingleton(DefaultListableBeanFactory beanFactory) {

Review comment:
       The global instance of DubboConfigEarlyInitializationPostProcessor  holds in DubboConfigEarlyRegistrationPostProcessor is better.  
   DubboConfigEarlyInitializationPostProcessor  just a  BeanPostProcessor , it should not care for how to create and be registered.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] kylixs commented on a change in pull request #9397: [master] Fix DubboConfigEarlyInitializationPostProcessor problem

Posted by GitBox <gi...@apache.org>.
kylixs commented on a change in pull request #9397:
URL: https://github.com/apache/dubbo/pull/9397#discussion_r768610463



##########
File path: dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/config/DubboConfigEarlyInitializationPostProcessor.java
##########
@@ -45,27 +42,27 @@
  * @see GenericBeanPostProcessorAdapter
  * @since 2.7.9
  */
-public class DubboConfigEarlyInitializationPostProcessor extends GenericBeanPostProcessorAdapter<AbstractConfig>
-        implements BeanDefinitionRegistryPostProcessor, PriorityOrdered {
+public class DubboConfigEarlyInitializationPostProcessor extends GenericBeanPostProcessorAdapter<AbstractConfig> {
 
     private static final Log logger = LogFactory.getLog(DubboConfigEarlyInitializationPostProcessor.class.getName());
 
-    public static final String BEAN_NAME = "dubboConfigEarlyInitializationPostProcessor";
+    private static DubboConfigEarlyInitializationPostProcessor SINGLETON;
 
     private DefaultListableBeanFactory beanFactory;
 
-    @Override
-    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
-        this.beanFactory = unwrap(registry);
-        initBeanFactory();
+    private DubboConfigEarlyInitializationPostProcessor(DefaultListableBeanFactory beanFactory) {
+        this.beanFactory = beanFactory;
     }
 
-    @Override
-    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
-        if (beanFactory == null) { // try again if postProcessBeanDefinitionRegistry method does not effect.
-            this.beanFactory = unwrap(beanFactory);
-            initBeanFactory();
+    public static DubboConfigEarlyInitializationPostProcessor getSingleton(DefaultListableBeanFactory beanFactory) {

Review comment:
       I think the DubboConfigEarlyInitializationPostProcessor can be changed to a inner class of DubboConfigEarlyRegistrationPostProcessor,  it's managed by DubboConfigEarlyRegistrationPostProcessor.  Then the relationship is more clear and reduce confusion.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org