ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
final Referenceable referenceable;
try {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
final SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
final ServiceRefHandler serviceRefHandler = spiProvider.getSPI(ServiceRefHandlerFactory.class).getServiceRefHandler();
referenceable = serviceRefHandler.createReferenceable(ref);
} finally {
Thread.currentThread().setContextClassLoader(contextClassLoader);
}
// setup binding description
BindingDescription bindingDescription = new BindingDescription(processor.getName(annotated), componentDescription);