Try to get it from the cache before generating the referenceKey#10173
Merged
AlbumenJ merged 1 commit intoapache:3.0from Aug 15, 2022
Conversation
Codecov Report
@@ Coverage Diff @@
## 3.0 #10173 +/- ##
============================================
- Coverage 65.72% 65.70% -0.02%
+ Complexity 319 318 -1
============================================
Files 1224 1229 +5
Lines 53325 53524 +199
Branches 8062 8094 +32
============================================
+ Hits 35046 35170 +124
- Misses 14459 14514 +55
- Partials 3820 3840 +20
Continue to review full report at Codecov.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
在注解方式配置模式中,在
ReferenceAnnotationBeanPostProcessor#registerReferenceBean方法中会执行ReferenceBeanSupport.generateReferenceKey(attributes, applicationContext)会生成referenceKey并写入ReferenceManager#referenceKeyMap缓存中。后续发生
ReferenceAnnotationBeanPostProcessor#doGetInjectedBean->ReferenceBean#afterPropertiesSet->ReferenceManager#addReference,该方法中又再次调用generateReferenceKey方法来构建referenceKey(generateReferenceKey方法相对耗时),其实可以从缓存直接获取。并且
ReferenceBeanManager#initReferenceBean方法发生在ReferenceBeanManager#addReference方法后,也可以先尝试从ReferenceManager#referenceKeyMap缓存中获取