Skip to content

Commit

Permalink
GH-1018 - Observability proxying now uses original bean class loader.
Browse files Browse the repository at this point in the history
Back-port of GH-1016.
Original issue: spring-projects/spring-data-rest#2438.
  • Loading branch information
odrotbohm committed Jan 17, 2025
1 parent eaaefcd commit b34e887
Showing 1 changed file with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,12 @@
import org.springframework.aop.Advisor;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.scheduling.annotation.AsyncAnnotationAdvisor;

/**
* @author Oliver Drotbohm
*/
class ModuleTracingSupport implements BeanClassLoaderAware {

private ClassLoader classLoader;

/*
* (non-Javadoc)
* @see org.springframework.beans.factory.BeanClassLoaderAware#setBeanClassLoader(java.lang.ClassLoader)
*/
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}
class ModuleTracingSupport {

protected final Object addAdvisor(Object bean, Advisor advisor) {
return addAdvisor(bean, advisor, __ -> {});
Expand All @@ -57,7 +45,7 @@ protected final Object addAdvisor(Object bean, Advisor advisor, Consumer<ProxyFa
customizer.accept(factory);
factory.addAdvisor(advisor);

return factory.getProxy(classLoader);
return factory.getProxy(bean.getClass().getClassLoader());
}
}

Expand Down

0 comments on commit b34e887

Please sign in to comment.