Use ApplicationContext classloader for MappingCouchbaseConverter. (#1704)

Closes #1691.
This commit is contained in:
Michael Reiche
2023-03-30 12:03:18 -07:00
committed by GitHub
parent 29167a266c
commit 0b7ae94dd0

View File

@@ -29,6 +29,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;
@@ -819,6 +820,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);
}
}
/**