Skip to content

Commit c4527da

Browse files
committed
Enable Streamable for Pageable use.
Closes #3397
1 parent 05f5059 commit c4527da

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/main/java/org/springframework/data/repository/util/QueryExecutionConverters.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public abstract class QueryExecutionConverters {
100100
ALLOWED_PAGEABLE_TYPES.add(Slice.class);
101101
ALLOWED_PAGEABLE_TYPES.add(Page.class);
102102
ALLOWED_PAGEABLE_TYPES.add(List.class);
103+
ALLOWED_PAGEABLE_TYPES.add(Streamable.class);
103104
ALLOWED_PAGEABLE_TYPES.add(Window.class);
104105
ALLOWED_PAGEABLE_TYPES.add(SearchResults.class);
105106

src/test/java/org/springframework/data/repository/query/QueryMethodUnitTests.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,16 @@ void doesNotRejectStreamingForPagination() throws Exception {
206206
assertThat(new QueryMethod(method, repositoryMetadata, factory, DefaultParameters::new).isStreamQuery()).isTrue();
207207
}
208208

209+
@Test // GH-3397
210+
void doesNotRejectStreamableForPagination() throws Exception {
211+
212+
RepositoryMetadata repositoryMetadata = new DefaultRepositoryMetadata(SampleRepository.class);
213+
var method = SampleRepository.class.getMethod("streamable", Pageable.class);
214+
215+
assertThat(new QueryMethod(method, repositoryMetadata, factory, DefaultParameters::new).isCollectionQuery())
216+
.isTrue();
217+
}
218+
209219
@Test // DATACMNS-716
210220
void doesNotRejectCompletableFutureQueryForSingleEntity() throws Exception {
211221

@@ -445,6 +455,8 @@ interface SampleRepository extends Repository<User, Serializable> {
445455

446456
Stream<String> streaming(Pageable pageable);
447457

458+
Streamable<String> streamable(Pageable pageable);
459+
448460
// DATACMNS-716
449461
CompletableFuture<User> returnsCompletableFutureForSingleEntity();
450462

0 commit comments

Comments
 (0)