Skip to content

Commit 7b9ca43

Browse files
committed
Keep CGLIB optional.
1 parent 5f27ff5 commit 7b9ca43

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@
3030
import org.apache.ibatis.cache.CacheKey;
3131
import org.apache.ibatis.executor.Executor;
3232
import org.apache.ibatis.executor.ExecutorException;
33-
import org.apache.ibatis.executor.loader.ProxyFactory;
3433
import org.apache.ibatis.executor.loader.ResultLoader;
3534
import org.apache.ibatis.executor.loader.ResultLoaderMap;
36-
import org.apache.ibatis.executor.loader.cglib.CglibProxyFactory;
3735
import org.apache.ibatis.executor.parameter.ParameterHandler;
3836
import org.apache.ibatis.executor.result.DefaultResultContext;
3937
import org.apache.ibatis.executor.result.DefaultResultHandler;
@@ -68,7 +66,6 @@ public class DefaultResultSetHandler implements ResultSetHandler {
6866
private final BoundSql boundSql;
6967
private final TypeHandlerRegistry typeHandlerRegistry;
7068
private final ObjectFactory objectFactory;
71-
private final ProxyFactory proxyFactory;
7269

7370
// nested resultmaps
7471
private final Map<CacheKey, Object> nestedResultObjects = new HashMap<CacheKey, Object>();
@@ -95,7 +92,6 @@ public DefaultResultSetHandler(Executor executor, MappedStatement mappedStatemen
9592
this.typeHandlerRegistry = configuration.getTypeHandlerRegistry();
9693
this.objectFactory = configuration.getObjectFactory();
9794
this.resultHandler = resultHandler;
98-
this.proxyFactory = configuration.getProxyFactory() == null ? new CglibProxyFactory() : configuration.getProxyFactory();
9995
}
10096

10197
//
@@ -509,7 +505,7 @@ private Object createResultObject(ResultSetWrapper rsw, ResultMap resultMap, Res
509505
final List<ResultMapping> propertyMappings = resultMap.getPropertyResultMappings();
510506
for (ResultMapping propertyMapping : propertyMappings) {
511507
if (propertyMapping.getNestedQueryId() != null && propertyMapping.isLazy()) { // issue gcode #109 && issue #149
512-
return proxyFactory.createProxy(resultObject, lazyLoader, configuration, objectFactory, constructorArgTypes, constructorArgs);
508+
return configuration.getProxyFactory().createProxy(resultObject, lazyLoader, configuration, objectFactory, constructorArgTypes, constructorArgs);
513509
}
514510
}
515511
}

src/main/java/org/apache/ibatis/session/Configuration.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ public void setLazyLoadingEnabled(boolean lazyLoadingEnabled) {
292292
}
293293

294294
public ProxyFactory getProxyFactory() {
295+
if (proxyFactory == null) {
296+
// makes sure CGLIB is not needed unless explicitly requested
297+
proxyFactory = new CglibProxyFactory();
298+
}
295299
return proxyFactory;
296300
}
297301

0 commit comments

Comments
 (0)