check interfaceClass and classLoader before load

This commit is contained in:
ken.lj 2022-01-19 10:31:06 +08:00
parent 5672670d88
commit 247a0ee9f4
1 changed files with 3 additions and 3 deletions

View File

@ -566,11 +566,11 @@ public class ReferenceConfig<T> extends ReferenceConfigBase<T> {
interfaceClass = GenericService.class;
} else {
try {
if (getInterfaceClassLoader() != null) {
if (getInterfaceClassLoader() != null && (interfaceClass == null || interfaceClass.getClassLoader() != getInterfaceClassLoader())) {
interfaceClass = Class.forName(interfaceName, true, getInterfaceClassLoader());
} else {
} else if (interfaceClass == null) {
interfaceClass = Class.forName(interfaceName, true, Thread.currentThread()
.getContextClassLoader());
.getContextClassLoader());
}
} catch (ClassNotFoundException e) {
throw new IllegalStateException(e.getMessage(), e);