ban-xiu commented on PR #16144:
URL: https://github.com/apache/dubbo/pull/16144#issuecomment-4134171954
@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.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]