DATAJPA-757 - Tweaked conversion service in JpaQueryExecution.
With 83a3db we switched from a GenericConversionService to DefaultConversionService to be able to transparently convert non-Long results for count query executions into Longs. Unfortunately the additional converters registered in DefaultConversionService now also kick in on the early conversion attempt. This is especially problematic for collection results that are wrapped into a (Completable)Future as the CollectionToObjectConverter opts into conversions from an arbitrary collection to objects trying to figure out element type conversion later on. We now explicitly deregister the conversions from Collection to Object (which is the convertible pair that CollectionToObjectConverter registers for) to avoid the conversion service to try to convert those values.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.jpa.repository.query;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -41,7 +42,7 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* Set of classes to contain query execution strategies. Depending (mostly) on the return type of a
|
||||
* {@link org.springframework.data.repository.query.QueryMethod} a {@link AbstractStringBasedJpaQuery} can be executed
|
||||
* in various flavours.
|
||||
* in various flavors.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
@@ -53,6 +54,7 @@ public abstract class JpaQueryExecution {
|
||||
static {
|
||||
|
||||
ConfigurableConversionService conversionService = new DefaultConversionService();
|
||||
conversionService.removeConvertible(Collection.class, Object.class);
|
||||
conversionService.addConverter(JpaResultConverters.BlobToByteArrayConverter.INSTANCE);
|
||||
|
||||
CONVERSION_SERVICE = conversionService;
|
||||
|
||||
Reference in New Issue
Block a user