@@ -112,12 +112,11 @@ public Class<?> enhance(Class<?> configClass, @Nullable ClassLoader classLoader)
112
112
113
113
try {
114
114
// Use original ClassLoader if config class not locally loaded in overriding class loader
115
- if (classLoader instanceof SmartClassLoader smartClassLoader &&
116
- classLoader != configClass . getClassLoader () ) {
115
+ boolean classLoaderMismatch = (classLoader != null && classLoader != configClass . getClassLoader ());
116
+ if ( classLoaderMismatch && classLoader instanceof SmartClassLoader smartClassLoader ) {
117
117
classLoader = smartClassLoader .getOriginalClassLoader ();
118
118
}
119
119
Enhancer enhancer = newEnhancer (configClass , classLoader );
120
- boolean classLoaderMismatch = (classLoader != null && classLoader != configClass .getClassLoader ());
121
120
Class <?> enhancedClass = createClass (enhancer , classLoaderMismatch );
122
121
if (logger .isTraceEnabled ()) {
123
122
logger .trace (String .format ("Successfully enhanced %s; enhanced class name is: %s" ,
@@ -188,8 +187,7 @@ private Class<?> createClass(Enhancer enhancer, boolean fallback) {
188
187
/**
189
188
* Marker interface to be implemented by all @Configuration CGLIB subclasses.
190
189
* Facilitates idempotent behavior for {@link ConfigurationClassEnhancer#enhance}
191
- * through checking to see if candidate classes are already assignable to it, e.g.
192
- * have already been enhanced.
190
+ * through checking to see if candidate classes are already assignable to it.
193
191
* <p>Also extends {@link BeanFactoryAware}, as all enhanced {@code @Configuration}
194
192
* classes require access to the {@link BeanFactory} that created them.
195
193
* <p>Note that this interface is intended for framework-internal use only, however
0 commit comments