From 3f2c78533e8a60b0c44b7423e24eddff6bb322ef Mon Sep 17 00:00:00 2001 From: barreiro Date: Fri, 25 Sep 2015 03:08:55 +0100 Subject: [PATCH] HHH-10112 - [enhancer] Use loading classloader in ClassPool --- .../org/hibernate/bytecode/enhance/spi/Enhancer.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/Enhancer.java b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/Enhancer.java index a098277dba..343dcbcf13 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/Enhancer.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/Enhancer.java @@ -93,8 +93,14 @@ public class Enhancer { } } - private ClassPool buildClassPool(EnhancementContext enhancementContext) { - final ClassPool classPool = new ClassPool( false ); + private ClassPool buildClassPool(final EnhancementContext enhancementContext) { + final ClassPool classPool = new ClassPool( false ) { + @Override + public ClassLoader getClassLoader() { + return enhancementContext.getLoadingClassLoader(); + } + }; + final ClassLoader loadingClassLoader = enhancementContext.getLoadingClassLoader(); if ( loadingClassLoader != null ) { classPool.appendClassPath( new LoaderClassPath( loadingClassLoader ) );