Skip to content

Commit 0ff4f0d

Browse files
committed
Use the ApplicationContext class loader for MappingCouchbaseConverter. (#1705)
Closes #1691.
1 parent 5499a75 commit 0ff4f0d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/org/springframework/data/couchbase/core/convert/MappingCouchbaseConverter.java

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.TreeMap;
3131
import java.util.UUID;
3232

33+
import org.springframework.beans.factory.BeanClassLoaderAware;
3334
import org.springframework.context.ApplicationContext;
3435
import org.springframework.context.ApplicationContextAware;
3536
import org.springframework.core.CollectionFactory;
@@ -902,6 +903,10 @@ public void setApplicationContext(ApplicationContext applicationContext) {
902903
if (entityCallbacks == null) {
903904
setEntityCallbacks(EntityCallbacks.create(applicationContext));
904905
}
906+
ClassLoader classLoader = applicationContext.getClassLoader();
907+
if (this.typeMapper instanceof BeanClassLoaderAware && classLoader != null) {
908+
((BeanClassLoaderAware) this.typeMapper).setBeanClassLoader(classLoader);
909+
}
905910
}
906911

907912
/**

0 commit comments

Comments
 (0)