Skip to content

Fix issue 16083#16144

Open
ban-xiu wants to merge 4 commits intoapache:3.3from
ban-xiu:fix-issue-16083
Open

Fix issue 16083#16144
ban-xiu wants to merge 4 commits intoapache:3.3from
ban-xiu:fix-issue-16083

Conversation

@ban-xiu
Copy link
Copy Markdown

@ban-xiu ban-xiu commented Mar 16, 2026

What is the purpose of the change?

Close #16083

Checklist

  • Make sure there is a GitHub_issue field for the change.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Make sure gitHub actions can pass. Why the workflow is failing and how to fix it?

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.82%. Comparing base (b54059d) to head (0cad8ee).

Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #16144      +/-   ##
============================================
+ Coverage     60.80%   60.82%   +0.02%     
+ Complexity    11767    11756      -11     
============================================
  Files          1953     1953              
  Lines         89118    89118              
  Branches      13444    13444              
============================================
+ Hits          54190    54208      +18     
+ Misses        29367    29353      -14     
+ Partials       5561     5557       -4     
Flag Coverage Δ
integration-tests-java21 32.17% <100.00%> (+<0.01%) ⬆️
integration-tests-java8 32.22% <100.00%> (-0.02%) ⬇️
samples-tests-java21 32.17% <80.00%> (+<0.01%) ⬆️
samples-tests-java8 29.82% <80.00%> (+0.10%) ⬆️
unit-tests-java11 59.03% <100.00%> (-0.01%) ⬇️
unit-tests-java17 58.53% <100.00%> (+0.03%) ⬆️
unit-tests-java21 58.51% <100.00%> (-0.03%) ⬇️
unit-tests-java25 58.50% <100.00%> (+<0.01%) ⬆️
unit-tests-java8 59.07% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ban-xiu
Copy link
Copy Markdown
Author

ban-xiu commented Mar 16, 2026

In this mode, ensure that invoker.getInterface() (i.e., GenericService) is placed at the forefront.

@zrlw
Copy link
Copy Markdown
Contributor

zrlw commented Mar 17, 2026

this pr might cause problem if the dubbo generice service references are created without annotation @Bean.
Dubbo registers reference beans into the Spring container automatically no matter using annotation @Bean or not.

@ban-xiu
Copy link
Copy Markdown
Author

ban-xiu commented Mar 17, 2026

this pr might cause problem if the dubbo generice service references are created without annotation @Bean. Dubbo registers reference beans into the Spring container automatically no matter using annotation @Bean or not.

It seems that the only scenario where the interface order of AbstractProxyFactory needs to take effect for Spring is when users entirely bypass ReferenceBean and directly call referenceConfig.get() in a @bean method—which is precisely the case this PR aims to fix.

@ban-xiu
Copy link
Copy Markdown
Author

ban-xiu commented Mar 17, 2026

It seems that scenarios without @bean won't cause issues either, because those cases are protected by the lazy proxy layer.

@ban-xiu ban-xiu closed this Mar 19, 2026
@ban-xiu ban-xiu reopened this Mar 19, 2026
@ban-xiu ban-xiu closed this Mar 19, 2026
@ban-xiu ban-xiu reopened this Mar 19, 2026
@ban-xiu ban-xiu closed this Mar 21, 2026
@ban-xiu ban-xiu reopened this Mar 21, 2026
@ban-xiu
Copy link
Copy Markdown
Author

ban-xiu commented Mar 26, 2026

@zrlw I looked into this concern. This change only reorders two code blocks — the final set of interfaces the proxy implements stays exactly the same, just the iteration
order in LinkedHashSet changes.

My understanding is that for references created without @bean (via @DubboReference or XML), Spring resolves bean type through ReferenceBean.getObjectType(), which
returns interfaceClass directly and doesn't depend on proxy interface order. So I think this change should not affect those scenarios. But please correct me if I'm
missing something here.

As for why the reorder helps the @bean case: Javassist Proxy.getProxy() uses ics[0].getClassLoader() to create the proxy class. Before this change, ics[0] was the
user's business interface (e.g. com.xxx.XxxService), whose classloader might not be compatible with GenericService. After this change, ics[0] becomes GenericService,
and its classloader (Dubbo's classloader) generally has better visibility.

Would love to hear your thoughts — happy to adjust the approach if there are cases I haven't considered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants