Use the ApplicationContext class loader for MappingCouchbaseConverter. (#1705)

Closes #1691.
This commit is contained in:
Michael Reiche
2023-03-30 12:05:14 -07:00
committed by mikereiche
parent 5499a75c23
commit 0ff4f0d7d7

View File

@@ -30,6 +30,7 @@ import java.util.Optional;
import java.util.TreeMap;
import java.util.UUID;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.CollectionFactory;
@@ -902,6 +903,10 @@ public class MappingCouchbaseConverter extends AbstractCouchbaseConverter implem
if (entityCallbacks == null) {
setEntityCallbacks(EntityCallbacks.create(applicationContext));
}
ClassLoader classLoader = applicationContext.getClassLoader();
if (this.typeMapper instanceof BeanClassLoaderAware && classLoader != null) {
((BeanClassLoaderAware) this.typeMapper).setBeanClassLoader(classLoader);
}
}
/**