【发布时间】:2022-01-14 22:10:28
【问题描述】:
我的 RestController 中有这个方法:
@GetMapping("/")
public Mono<String> index(Model model) {
model.addAttribute("images", imageService.findAllImages());
return Mono.just("index");
}
当我运行我的应用程序时,我得到一个页面,除了左上角的文本 index 之外什么都没有。如果我将return Mono.just("index"); 更新为return Mono.just("foo");,那么foo 会显示在左上角。
我预计文件resources/templates/index.html 会显示在浏览器中。我该如何解决这个问题?
【问题讨论】:
-
是用
Controller还是RestController注解?请使用Controller注释尝试一次。
标签: java spring-boot thymeleaf