java-tutorials/kdoyle/RealTimeTest.java
2018-06-27 19:58:58 -04:00

22 lines
604 B
Java

package com.baeldung.reactive.kdoyle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.client.WebClient;
@Component
public class RealTimeTest {
@Autowired
WebClient client;
public void read(){
client.get().uri("/read")
.accept(MediaType.TEXT_EVENT_STREAM)
.retrieve()
.bodyToFlux(ReadingBook.class)
.subscribe(System.out::println);
}
}