36
36
import org .springframework .data .repository .util .ReactiveWrapperConverters ;
37
37
import org .springframework .data .repository .util .ReactiveWrappers ;
38
38
import org .springframework .data .util .ClassTypeInformation ;
39
+ import org .springframework .data .util .Lazy ;
39
40
import org .springframework .data .util .TypeInformation ;
40
41
import org .springframework .util .ClassUtils ;
41
42
@@ -48,6 +49,7 @@ public class ReactiveElasticsearchQueryMethod extends ElasticsearchQueryMethod {
48
49
49
50
private static final ClassTypeInformation <Page > PAGE_TYPE = ClassTypeInformation .from (Page .class );
50
51
private static final ClassTypeInformation <Slice > SLICE_TYPE = ClassTypeInformation .from (Slice .class );
52
+ private final Lazy <Boolean > isCollectionQuery ;
51
53
52
54
public ReactiveElasticsearchQueryMethod (Method method , RepositoryMetadata metadata , ProjectionFactory factory ,
53
55
MappingContext <? extends ElasticsearchPersistentEntity <?>, ElasticsearchPersistentProperty > mappingContext ) {
@@ -80,6 +82,9 @@ public ReactiveElasticsearchQueryMethod(Method method, RepositoryMetadata metada
80
82
+ "Use sorting capabilities on Pageble instead! Offending method: %s" , method .toString ()));
81
83
}
82
84
}
85
+
86
+ this .isCollectionQuery = Lazy .of (() -> (!(isPageQuery () || isSliceQuery ())
87
+ && ReactiveWrappers .isMultiValueType (metadata .getReturnType (method ).getType ()) || super .isCollectionQuery ()));
83
88
}
84
89
85
90
@ Override
@@ -103,6 +108,15 @@ public boolean hasReactiveWrapperParameter() {
103
108
return false ;
104
109
}
105
110
111
+ /*
112
+ * (non-Javadoc)
113
+ * @see org.springframework.data.repository.query.QueryMethod#isCollectionQuery()
114
+ */
115
+ @ Override
116
+ public boolean isCollectionQuery () {
117
+ return isCollectionQuery .get ();
118
+ }
119
+
106
120
/*
107
121
* (non-Javadoc)
108
122
* @see org.springframework.data.repository.query.QueryMethod#isStreamQuery()
0 commit comments