Skip to content

Commit 0b7ae94

Browse files
authored
Use ApplicationContext classloader for MappingCouchbaseConverter. (#1704)
Closes #1691.
1 parent 29167a2 commit 0b7ae94

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.TreeMap;
3030
import java.util.UUID;
3131

32+
import org.springframework.beans.factory.BeanClassLoaderAware;
3233
import org.springframework.context.ApplicationContext;
3334
import org.springframework.context.ApplicationContextAware;
3435
import org.springframework.core.CollectionFactory;
@@ -819,6 +820,10 @@ public void setApplicationContext(ApplicationContext applicationContext) {
819820
if (entityCallbacks == null) {
820821
setEntityCallbacks(EntityCallbacks.create(applicationContext));
821822
}
823+
ClassLoader classLoader = applicationContext.getClassLoader();
824+
if (this.typeMapper instanceof BeanClassLoaderAware && classLoader != null) {
825+
((BeanClassLoaderAware) this.typeMapper).setBeanClassLoader(classLoader);
826+
}
822827
}
823828

824829
/**

0 commit comments

Comments
 (0)