mirror of
https://github.com/JeffLi1993/springboot-learning-example.git
synced 2026-03-15 07:03:49 +08:00
WebFlux 快速入门
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package org.spring.springboot.handler;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.reactive.function.BodyInserters;
|
||||
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Component
|
||||
public class CityHandler {
|
||||
|
||||
public Mono<ServerResponse> helloCity(ServerRequest request) {
|
||||
return ServerResponse.ok().contentType(MediaType.TEXT_PLAIN)
|
||||
.body(BodyInserters.fromObject("Hello, City!"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user