Spring Boot WebFlux 整合 Thymeleaf

This commit is contained in:
liqiangqiang
2018-04-20 09:22:08 +08:00
parent 86aedc590e
commit 7f681370fa
2 changed files with 22 additions and 0 deletions

View File

@@ -46,6 +46,15 @@ public class CityWebFluxController {
return cityHandler.deleteCity(id);
}
@GetMapping("/hello")
public Mono<String> 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")

View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8"/>
<title>欢迎页面</title>
</head>
<body>
<h1 >你好,欢迎来自<p th:text="${city}"></p><p th:text="${name}"></p></h1>
</body>
</html>