From 7f681370fa5ccaaf2337df794763f1a2ec733dcd Mon Sep 17 00:00:00 2001 From: liqiangqiang Date: Fri, 20 Apr 2018 09:22:08 +0800 Subject: [PATCH] =?UTF-8?q?Spring=20Boot=20WebFlux=20=E6=95=B4=E5=90=88=20?= =?UTF-8?q?Thymeleaf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webflux/controller/CityWebFluxController.java | 9 +++++++++ .../src/main/resources/templates/hello.html | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 springboot-webflux-4-thymeleaf/src/main/resources/templates/hello.html diff --git a/springboot-webflux-4-thymeleaf/src/main/java/org/spring/springboot/webflux/controller/CityWebFluxController.java b/springboot-webflux-4-thymeleaf/src/main/java/org/spring/springboot/webflux/controller/CityWebFluxController.java index a0bb558..8e9559d 100644 --- a/springboot-webflux-4-thymeleaf/src/main/java/org/spring/springboot/webflux/controller/CityWebFluxController.java +++ b/springboot-webflux-4-thymeleaf/src/main/java/org/spring/springboot/webflux/controller/CityWebFluxController.java @@ -46,6 +46,15 @@ public class CityWebFluxController { return cityHandler.deleteCity(id); } + @GetMapping("/hello") + public Mono hello(final Model model) { + model.addAttribute("name", "泥瓦匠"); + model.addAttribute("city", "浙江温岭"); + + String path = "hello"; + return Mono.create(monoSink -> monoSink.success(path)); + } + private static final String CITY_LIST_PATH_NAME = "cityList"; @GetMapping("/page/list") diff --git a/springboot-webflux-4-thymeleaf/src/main/resources/templates/hello.html b/springboot-webflux-4-thymeleaf/src/main/resources/templates/hello.html new file mode 100644 index 0000000..c20d6c4 --- /dev/null +++ b/springboot-webflux-4-thymeleaf/src/main/resources/templates/hello.html @@ -0,0 +1,13 @@ + + + + + 欢迎页面 + + + + +

你好,欢迎来自

+ + +