DATACMNS-1121 - ProxyProjectionFactory now returns instance as is if it implements the target.
If you previously asked ProxyProjectionFactory for a proxy of an interface which the target instance already implements, it created a proxy although it could've returned the instance as is. It's now actually doing that avoiding superfluous proxy creation.
This commit is contained in:
@@ -96,8 +96,8 @@ class ProxyProjectionFactory implements ProjectionFactory, BeanClassLoaderAware
|
||||
Assert.notNull(projectionType, "Projection type must not be null!");
|
||||
Assert.isTrue(projectionType.isInterface(), "Projection type must be an interface!");
|
||||
|
||||
if (source == null) {
|
||||
return null;
|
||||
if (source == null || projectionType.isInstance(source)) {
|
||||
return (T) source;
|
||||
}
|
||||
|
||||
ProxyFactory factory = new ProxyFactory();
|
||||
|
||||
Reference in New Issue
Block a user