From 3f5570641359b13c3d9139879c66500f31d007c5 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Sat, 17 Sep 2016 11:29:04 +0200 Subject: [PATCH] Rename BodyPopulator to BodyInsertor --- .../{BodyPopulator.java => BodyInsertor.java} | 41 ++++++------ ...BodyPopulators.java => BodyInsertors.java} | 66 +++++++++---------- .../function/DefaultResponseBuilder.java | 26 ++++---- .../web/reactive/function/Response.java | 8 +-- ...torsTests.java => BodyInsertorsTests.java} | 36 +++++----- .../function/DefaultResponseBuilderTests.java | 2 +- .../DispatcherHandlerIntegrationTests.java | 4 +- ...lisherHandlerFunctionIntegrationTests.java | 2 +- .../function/RouterFunctionTests.java | 2 +- .../SseHandlerFunctionIntegrationTests.java | 6 +- 10 files changed, 96 insertions(+), 97 deletions(-) rename spring-web-reactive/src/main/java/org/springframework/web/reactive/function/{BodyPopulator.java => BodyInsertor.java} (67%) rename spring-web-reactive/src/main/java/org/springframework/web/reactive/function/{BodyPopulators.java => BodyInsertors.java} (79%) rename spring-web-reactive/src/test/java/org/springframework/web/reactive/function/{BodyPopulatorsTests.java => BodyInsertorsTests.java} (83%) diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyPopulator.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyInsertor.java similarity index 67% rename from spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyPopulator.java rename to spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyInsertor.java index 66636f83e9..b8a4f9936c 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyPopulator.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyInsertor.java @@ -25,32 +25,15 @@ import org.springframework.http.server.reactive.ServerHttpResponse; import org.springframework.util.Assert; /** - * A combination of functions that can populate a {@link Response} body. + * A combination of functions that can insert data into a {@link Response} body. * * @author Arjen Poutsma * @since 5.0 * @see Response#body() - * @see Response.BodyBuilder#body(BodyPopulator) - * @see BodyPopulators + * @see Response.BodyBuilder#body(BodyInsertor) + * @see BodyInsertors */ -public interface BodyPopulator { - - /** - * Return a new {@code BodyPopulator} described by the given writer and supplier functions. - - * @param writer the writer function for the new populator - * @param supplier the supplier function for the new populator - * @param the type supplied and written by the populator - * @return the new {@code BodyPopulator} - */ - static BodyPopulator of(BiFunction> writer, - Supplier supplier) { - - Assert.notNull(writer, "'writer' must not be null"); - Assert.notNull(supplier, "'supplier' must not be null"); - - return new BodyPopulators.DefaultBodyPopulator(writer, supplier); - } +public interface BodyInsertor { /** * Return a function that writes to the given response body. @@ -62,4 +45,20 @@ public interface BodyPopulator { */ Supplier supplier(); + /** + * Return a new {@code BodyInsertor} described by the given writer and supplier functions. + * @param writer the writer function for the new insertor + * @param supplier the supplier function for the new insertor + * @param the type supplied and written by the insertor + * @return the new {@code BodyInsertor} + */ + static BodyInsertor of(BiFunction> writer, + Supplier supplier) { + + Assert.notNull(writer, "'writer' must not be null"); + Assert.notNull(supplier, "'supplier' must not be null"); + + return new BodyInsertors.DefaultBodyInsertor(writer, supplier); + } + } diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyPopulators.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyInsertors.java similarity index 79% rename from spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyPopulators.java rename to spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyInsertors.java index 273ccdfdca..9b12adf2a3 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyPopulators.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyInsertors.java @@ -37,13 +37,13 @@ import org.springframework.util.Assert; import org.springframework.util.ClassUtils; /** - * Implementations of {@link BodyPopulator} that write various bodies, such a reactive streams, + * Implementations of {@link BodyInsertor} that write various bodies, such a reactive streams, * server-sent events, resources, etc. * * @author Arjen Poutsma * @since 5.0 */ -public abstract class BodyPopulators { +public abstract class BodyInsertors { private static final ResolvableType RESOURCE_TYPE = ResolvableType.forClass(Resource.class); @@ -52,32 +52,32 @@ public abstract class BodyPopulators { private static final boolean jackson2Present = ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", - BodyPopulators.class.getClassLoader()) && + BodyInsertors.class.getClassLoader()) && ClassUtils.isPresent("com.fasterxml.jackson.core.JsonGenerator", - BodyPopulators.class.getClassLoader()); + BodyInsertors.class.getClassLoader()); /** - * Return a {@code BodyPopulator} that writes the given single object. + * Return a {@code BodyInsertor} that writes the given single object. * @param body the body of the response - * @return a {@code BodyPopulator} that writes a single object + * @return a {@code BodyInsertor} that writes a single object */ - public static BodyPopulator fromObject(T body) { + public static BodyInsertor fromObject(T body) { Assert.notNull(body, "'body' must not be null"); - return BodyPopulator.of( + return BodyInsertor.of( (response, configuration) -> writeWithMessageWriters(response, configuration, Mono.just(body), ResolvableType.forInstance(body)), () -> body); } /** - * Return a {@code BodyPopulator} that writes the given {@link Publisher}. + * Return a {@code BodyInsertor} that writes the given {@link Publisher}. * @param publisher the publisher to stream to the response body * @param elementClass the class of elements contained in the publisher * @param the type of the elements contained in the publisher * @param the type of the {@code Publisher}. - * @return a {@code BodyPopulator} that writes a {@code Publisher} + * @return a {@code BodyInsertor} that writes a {@code Publisher} */ - public static , T> BodyPopulator fromPublisher(S publisher, + public static , T> BodyInsertor fromPublisher(S publisher, Class elementClass) { Assert.notNull(publisher, "'publisher' must not be null"); @@ -86,19 +86,19 @@ public abstract class BodyPopulators { } /** - * Return a {@code BodyPopulator} that writes the given {@link Publisher}. + * Return a {@code BodyInsertor} that writes the given {@link Publisher}. * @param publisher the publisher to stream to the response body * @param elementType the type of elements contained in the publisher * @param the type of the elements contained in the publisher * @param the type of the {@code Publisher}. - * @return a {@code BodyPopulator} that writes a {@code Publisher} + * @return a {@code BodyInsertor} that writes a {@code Publisher} */ - public static , T> BodyPopulator fromPublisher(S publisher, + public static , T> BodyInsertor fromPublisher(S publisher, ResolvableType elementType) { Assert.notNull(publisher, "'publisher' must not be null"); Assert.notNull(elementType, "'elementType' must not be null"); - return BodyPopulator.of( + return BodyInsertor.of( (response, configuration) -> writeWithMessageWriters(response, configuration, publisher, elementType), () -> publisher @@ -106,17 +106,17 @@ public abstract class BodyPopulators { } /** - * Return a {@code BodyPopulator} that writes the given {@code Resource}. + * Return a {@code BodyInsertor} that writes the given {@code Resource}. * If the resource can be resolved to a {@linkplain Resource#getFile() file}, it will be copied * using * zero-copy * @param resource the resource to write to the response * @param the type of the {@code Resource} - * @return a {@code BodyPopulator} that writes a {@code Publisher} + * @return a {@code BodyInsertor} that writes a {@code Publisher} */ - public static BodyPopulator fromResource(T resource) { + public static BodyInsertor fromResource(T resource) { Assert.notNull(resource, "'resource' must not be null"); - return BodyPopulator.of( + return BodyInsertor.of( (response, configuration) -> { ResourceHttpMessageWriter messageWriter = new ResourceHttpMessageWriter(); MediaType contentType = response.getHeaders().getContentType(); @@ -128,17 +128,17 @@ public abstract class BodyPopulators { } /** - * Return a {@code BodyPopulator} that writes the given {@code ServerSentEvent} publisher. + * Return a {@code BodyInsertor} that writes the given {@code ServerSentEvent} publisher. * @param eventsPublisher the {@code ServerSentEvent} publisher to write to the response body * @param the type of the elements contained in the {@link ServerSentEvent} - * @return a {@code BodyPopulator} that writes a {@code ServerSentEvent} publisher + * @return a {@code BodyInsertor} that writes a {@code ServerSentEvent} publisher * @see Server-Sent Events W3C recommendation */ - public static >> BodyPopulator fromServerSentEvents( + public static >> BodyInsertor fromServerSentEvents( S eventsPublisher) { Assert.notNull(eventsPublisher, "'eventsPublisher' must not be null"); - return BodyPopulator.of( + return BodyInsertor.of( (response, configuration) -> { ServerSentEventHttpMessageWriter messageWriter = sseMessageWriter(); MediaType contentType = response.getHeaders().getContentType(); @@ -150,16 +150,16 @@ public abstract class BodyPopulators { } /** - * Return a {@code BodyPopulator} that writes the given {@code Publisher} publisher as + * Return a {@code BodyInsertor} that writes the given {@code Publisher} publisher as * Server-Sent Events. * @param eventsPublisher the publisher to write to the response body as Server-Sent Events * @param eventClass the class of event contained in the publisher * @param the type of the elements contained in the publisher - * @return a {@code BodyPopulator} that writes the given {@code Publisher} publisher as + * @return a {@code BodyInsertor} that writes the given {@code Publisher} publisher as * Server-Sent Events * @see Server-Sent Events W3C recommendation */ - public static > BodyPopulator fromServerSentEvents(S eventsPublisher, + public static > BodyInsertor fromServerSentEvents(S eventsPublisher, Class eventClass) { Assert.notNull(eventsPublisher, "'eventsPublisher' must not be null"); @@ -168,21 +168,21 @@ public abstract class BodyPopulators { } /** - * Return a {@code BodyPopulator} that writes the given {@code Publisher} publisher as + * Return a {@code BodyInsertor} that writes the given {@code Publisher} publisher as * Server-Sent Events. * @param eventsPublisher the publisher to write to the response body as Server-Sent Events * @param eventType the type of event contained in the publisher * @param the type of the elements contained in the publisher - * @return a {@code BodyPopulator} that writes the given {@code Publisher} publisher as + * @return a {@code BodyInsertor} that writes the given {@code Publisher} publisher as * Server-Sent Events * @see Server-Sent Events W3C recommendation */ - public static > BodyPopulator fromServerSentEvents(S eventsPublisher, + public static > BodyInsertor fromServerSentEvents(S eventsPublisher, ResolvableType eventType) { Assert.notNull(eventsPublisher, "'eventsPublisher' must not be null"); Assert.notNull(eventType, "'eventType' must not be null"); - return BodyPopulator.of( + return BodyInsertor.of( (response, configuration) -> { ServerSentEventHttpMessageWriter messageWriter = sseMessageWriter(); MediaType contentType = response.getHeaders().getContentType(); @@ -211,7 +211,7 @@ public abstract class BodyPopulators { .filter(messageWriter -> messageWriter.canWrite(bodyType, contentType, Collections .emptyMap())) .findFirst() - .map(BodyPopulators::cast) + .map(BodyInsertors::cast) .map(messageWriter -> messageWriter .write(body, bodyType, contentType, response, Collections .emptyMap())) @@ -226,13 +226,13 @@ public abstract class BodyPopulators { return (HttpMessageWriter) messageWriter; } - static class DefaultBodyPopulator implements BodyPopulator { + static class DefaultBodyInsertor implements BodyInsertor { private final BiFunction> writer; private final Supplier supplier; - public DefaultBodyPopulator( + public DefaultBodyInsertor( BiFunction> writer, Supplier supplier) { this.writer = writer; diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/DefaultResponseBuilder.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/DefaultResponseBuilder.java index 0952d9930b..7ee70da385 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/DefaultResponseBuilder.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/DefaultResponseBuilder.java @@ -141,7 +141,7 @@ class DefaultResponseBuilder implements Response.BodyBuilder { @Override public Response build() { - return body(BodyPopulator.of( + return body(BodyInsertor.of( (response, configuration) -> response.setComplete(), () -> null)); } @@ -149,7 +149,7 @@ class DefaultResponseBuilder implements Response.BodyBuilder { @Override public > Response build(T voidPublisher) { Assert.notNull(voidPublisher, "'voidPublisher' must not be null"); - return body(BodyPopulator.of( + return body(BodyInsertor.of( (response, configuration) -> Flux.from(voidPublisher).then(response.setComplete()), () -> null)); } @@ -157,13 +157,13 @@ class DefaultResponseBuilder implements Response.BodyBuilder { @Override public Response body(BiFunction> writer, Supplier supplier) { - return body(BodyPopulator.of(writer, supplier)); + return body(BodyInsertor.of(writer, supplier)); } @Override - public Response body(BodyPopulator populator) { - Assert.notNull(populator, "'populator' must not be null"); - return new BodyPopulatorResponse(this.statusCode, this.headers, populator); + public Response body(BodyInsertor insertor) { + Assert.notNull(insertor, "'insertor' must not be null"); + return new BodyInsertorResponse(this.statusCode, this.headers, insertor); } @Override @@ -233,27 +233,27 @@ class DefaultResponseBuilder implements Response.BodyBuilder { } } - private static final class BodyPopulatorResponse extends AbstractResponse { + private static final class BodyInsertorResponse extends AbstractResponse { - private final BodyPopulator populator; + private final BodyInsertor insertor; - public BodyPopulatorResponse( - int statusCode, HttpHeaders headers, BodyPopulator populator) { + public BodyInsertorResponse( + int statusCode, HttpHeaders headers, BodyInsertor insertor) { super(statusCode, headers); - this.populator = populator; + this.insertor = insertor; } @Override public T body() { - return this.populator.supplier().get(); + return this.insertor.supplier().get(); } @Override public Mono writeTo(ServerWebExchange exchange, Configuration configuration) { ServerHttpResponse response = exchange.getResponse(); writeStatusAndHeaders(response); - return this.populator.writer().apply(response, configuration); + return this.insertor.writer().apply(response, configuration); } } diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/Response.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/Response.java index 97d85c29f2..88dc5b6d05 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/Response.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/function/Response.java @@ -308,7 +308,7 @@ public interface Response { BodyBuilder contentType(MediaType contentType); /** - * Write the body to the given {@code BodyPopulator} and return it. + * Write the body to the given {@code BodyInsertor} and return it. * @param writer a function that writes the body to the {@code ServerHttpResponse} * @param supplier a function that returns the body instance * @param the type contained in the body @@ -318,12 +318,12 @@ public interface Response { Supplier supplier); /** - * Set the body of the response to the given {@code BodyPopulator} and return it. - * @param populator the {@code BodyPopulator} that writes to the response + * Set the body of the response to the given {@code BodyInsertor} and return it. + * @param insertor the {@code BodyInsertor} that writes to the response * @param the type contained in the body * @return the built response */ - Response body(BodyPopulator populator); + Response body(BodyInsertor insertor); /** * Render the template with the given {@code name} using the given {@code modelAttributes}. diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/BodyPopulatorsTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/BodyInsertorsTests.java similarity index 83% rename from spring-web-reactive/src/test/java/org/springframework/web/reactive/function/BodyPopulatorsTests.java rename to spring-web-reactive/src/test/java/org/springframework/web/reactive/function/BodyInsertorsTests.java index 0356eea9a5..63e0d934e4 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/BodyPopulatorsTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/BodyInsertorsTests.java @@ -40,16 +40,16 @@ import static org.junit.Assert.assertEquals; /** * @author Arjen Poutsma */ -public class BodyPopulatorsTests { +public class BodyInsertorsTests { @Test public void ofObject() throws Exception { String body = "foo"; - BodyPopulator populator = BodyPopulators.fromObject(body); + BodyInsertor insertor = BodyInsertors.fromObject(body); - assertEquals(body, populator.supplier().get()); + assertEquals(body, insertor.supplier().get()); - BiFunction> writer = populator.writer(); + BiFunction> writer = insertor.writer(); MockServerHttpResponse response = new MockServerHttpResponse(); Mono result = writer.apply(response, Configuration.builder().build()); TestSubscriber.subscribe(result) @@ -65,11 +65,11 @@ public class BodyPopulatorsTests { @Test public void ofPublisher() throws Exception { Flux body = Flux.just("foo"); - BodyPopulator> populator = BodyPopulators.fromPublisher(body, String.class); + BodyInsertor> insertor = BodyInsertors.fromPublisher(body, String.class); - assertEquals(body, populator.supplier().get()); + assertEquals(body, insertor.supplier().get()); - BiFunction> writer = populator.writer(); + BiFunction> writer = insertor.writer(); MockServerHttpResponse response = new MockServerHttpResponse(); Mono result = writer.apply(response, Configuration.builder().build()); TestSubscriber.subscribe(result) @@ -85,11 +85,11 @@ public class BodyPopulatorsTests { @Test public void ofResource() throws Exception { Resource body = new ClassPathResource("response.txt", getClass()); - BodyPopulator populator = BodyPopulators.fromResource(body); + BodyInsertor insertor = BodyInsertors.fromResource(body); - assertEquals(body, populator.supplier().get()); + assertEquals(body, insertor.supplier().get()); - BiFunction> writer = populator.writer(); + BiFunction> writer = insertor.writer(); MockServerHttpResponse response = new MockServerHttpResponse(); Mono result = writer.apply(response, Configuration.builder().build()); TestSubscriber.subscribe(result) @@ -110,12 +110,12 @@ public class BodyPopulatorsTests { public void ofServerSentEventFlux() throws Exception { ServerSentEvent event = ServerSentEvent.builder("foo").build(); Flux> body = Flux.just(event); - BodyPopulator>> populator = - BodyPopulators.fromServerSentEvents(body); + BodyInsertor>> insertor = + BodyInsertors.fromServerSentEvents(body); - assertEquals(body, populator.supplier().get()); + assertEquals(body, insertor.supplier().get()); - BiFunction> writer = populator.writer(); + BiFunction> writer = insertor.writer(); MockServerHttpResponse response = new MockServerHttpResponse(); Mono result = writer.apply(response, Configuration.builder().build()); TestSubscriber.subscribe(result) @@ -126,12 +126,12 @@ public class BodyPopulatorsTests { @Test public void ofServerSentEventClass() throws Exception { Flux body = Flux.just("foo"); - BodyPopulator> populator = - BodyPopulators.fromServerSentEvents(body, String.class); + BodyInsertor> insertor = + BodyInsertors.fromServerSentEvents(body, String.class); - assertEquals(body, populator.supplier().get()); + assertEquals(body, insertor.supplier().get()); - BiFunction> writer = populator.writer(); + BiFunction> writer = insertor.writer(); MockServerHttpResponse response = new MockServerHttpResponse(); Mono result = writer.apply(response, Configuration.builder().build()); TestSubscriber.subscribe(result) diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/DefaultResponseBuilderTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/DefaultResponseBuilderTests.java index 0c83c91994..940d4191e9 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/DefaultResponseBuilderTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/DefaultResponseBuilderTests.java @@ -214,7 +214,7 @@ public class DefaultResponseBuilderTests { } @Test - public void bodyPopulator() throws Exception { + public void bodyInsertor() throws Exception { String body = "foo"; Supplier supplier = () -> body; BiFunction> writer = diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/DispatcherHandlerIntegrationTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/DispatcherHandlerIntegrationTests.java index 775646ac9d..21dce77b78 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/DispatcherHandlerIntegrationTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/DispatcherHandlerIntegrationTests.java @@ -155,14 +155,14 @@ public class DispatcherHandlerIntegrationTests extends AbstractHttpHandlerIntegr public Response> mono(Request request) { Person person = new Person("John"); - return Response.ok().body(BodyPopulators.fromPublisher(Mono.just(person), Person.class)); + return Response.ok().body(BodyInsertors.fromPublisher(Mono.just(person), Person.class)); } public Response> flux(Request request) { Person person1 = new Person("John"); Person person2 = new Person("Jane"); return Response.ok().body( - BodyPopulators.fromPublisher(Flux.just(person1, person2), Person.class)); + BodyInsertors.fromPublisher(Flux.just(person1, person2), Person.class)); } } diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/PublisherHandlerFunctionIntegrationTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/PublisherHandlerFunctionIntegrationTests.java index 10b5d3988a..51d22f9057 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/PublisherHandlerFunctionIntegrationTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/PublisherHandlerFunctionIntegrationTests.java @@ -34,7 +34,7 @@ import org.springframework.web.client.RestTemplate; import static org.junit.Assert.assertEquals; import static org.springframework.web.reactive.function.BodyExtractors.toMono; -import static org.springframework.web.reactive.function.BodyPopulators.fromPublisher; +import static org.springframework.web.reactive.function.BodyInsertors.fromPublisher; import static org.springframework.web.reactive.function.RequestPredicates.GET; import static org.springframework.web.reactive.function.RequestPredicates.POST; import static org.springframework.web.reactive.function.RouterFunctions.route; diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/RouterFunctionTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/RouterFunctionTests.java index bc7e00b1ce..3d52ef0b2b 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/RouterFunctionTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/RouterFunctionTests.java @@ -23,7 +23,7 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.springframework.web.reactive.function.BodyPopulators.fromObject; +import static org.springframework.web.reactive.function.BodyInsertors.fromObject; /** * @author Arjen Poutsma diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/SseHandlerFunctionIntegrationTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/SseHandlerFunctionIntegrationTests.java index 2ca7782771..7993c6d1fb 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/SseHandlerFunctionIntegrationTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/function/SseHandlerFunctionIntegrationTests.java @@ -111,13 +111,13 @@ public class SseHandlerFunctionIntegrationTests public Response> string(Request request) { Flux flux = Flux.interval(Duration.ofMillis(100)).map(l -> "foo " + l).take(2); - return Response.ok().body(BodyPopulators.fromServerSentEvents(flux, String.class)); + return Response.ok().body(BodyInsertors.fromServerSentEvents(flux, String.class)); } public Response> person(Request request) { Flux flux = Flux.interval(Duration.ofMillis(100)) .map(l -> new Person("foo " + l)).take(2); - return Response.ok().body(BodyPopulators.fromServerSentEvents(flux, Person.class)); + return Response.ok().body(BodyInsertors.fromServerSentEvents(flux, Person.class)); } public Response>> sse(Request request) { @@ -127,7 +127,7 @@ public class SseHandlerFunctionIntegrationTests .comment("bar") .build()).take(2); - return Response.ok().body(BodyPopulators.fromServerSentEvents(flux)); + return Response.ok().body(BodyInsertors.fromServerSentEvents(flux)); } }