DATACMNS-1357 - Use shared DefaultConversionService in ProxyProjectionFactory and ResultProcessor.
ProxyProjectionFactory and ResultProcessor require a DefaultConversionService to convert values for projection proxies and to post-process query method results. Creating instances of these types requires an instance of the conversion service which previously created a DefaultConversionService instance (along all converter registrations) upon ProxyProjection/ResultProcessor instantiation. We now use the shared instance that is initialized once and shared across all ProxyProjection/ResultProcessor instances to reduce garbage and improve the CPU profile.
This commit is contained in:
@@ -41,6 +41,7 @@ import org.springframework.util.ConcurrentReferenceHashMap;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @see SpelAwareProxyProjectionFactory
|
||||
* @since 1.10
|
||||
*/
|
||||
@@ -60,7 +61,7 @@ class ProxyProjectionFactory implements ProjectionFactory, BeanClassLoaderAware
|
||||
this.factories.add(MapAccessingMethodInterceptorFactory.INSTANCE);
|
||||
this.factories.add(PropertyAccessingMethodInvokerFactory.INSTANCE);
|
||||
|
||||
this.conversionService = new DefaultConversionService();
|
||||
this.conversionService = DefaultConversionService.getSharedInstance();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -260,7 +260,7 @@ public class ResultProcessor {
|
||||
* @param factory must not be {@literal null}.
|
||||
*/
|
||||
ProjectingConverter(ReturnedType type, ProjectionFactory factory) {
|
||||
this(type, factory, new DefaultConversionService());
|
||||
this(type, factory, DefaultConversionService.getSharedInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user