Fix ReferenceBean type mismatch and add regression test #15889
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.
What does this PR do?
This PR fixes a Spring type resolution issue where ReferenceBean#getObjectType() could return an incompatible or undefined type, which may lead to BeanNotOfRequiredTypeException during dependency injection.
A regression test is added to ensure that a Spring application context can start successfully when @DubboReference is injected into a constructor-managed bean.
Why is this needed?
Spring relies on FactoryBean#getObjectType() during bean type prediction and dependency matching.
Returning an incorrect or unresolved type at this stage can cause bean creation failures during application context initialization.
How was this tested?
Added ReferenceBeanTypeInjectionTest
All existing tests pass
Additional notes
No UI changes
No screenshots required
Fixes #12637
Kindly review this PR when you get time.
Thank you for your guidance.
@AlbumenJ @RainYuY