-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServerApplication.java
More file actions
26 lines (21 loc) · 894 Bytes
/
ServerApplication.java
File metadata and controls
26 lines (21 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package question4.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
@SpringBootApplication(scanBasePackages = "question4.server")
public class ServerApplication {
public static void main(String[] args) {
SpringApplication.run(ServerApplication.class, args);
}
@RestController
public static class HelloWorldReactorRestController {
@GetMapping(value = "/question4/millionvalues", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
Flux<Integer> millionvalues() {
return Flux.range(1, 1_000_000)
.doOnNext(System.out::println);
}
}
}