diff --git a/thymeleaf-webflux/src/main/java/com/example/thymeleaf/webflux/TestController.java b/thymeleaf-webflux/src/main/java/com/example/thymeleaf/webflux/TestController.java index f0ca0a44..0716aa79 100644 --- a/thymeleaf-webflux/src/main/java/com/example/thymeleaf/webflux/TestController.java +++ b/thymeleaf-webflux/src/main/java/com/example/thymeleaf/webflux/TestController.java @@ -2,6 +2,7 @@ package com.example.thymeleaf.webflux; import java.util.List; +import org.springframework.aot.hint.annotation.RegisterReflectionForBinding; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -14,12 +15,14 @@ import org.springframework.web.bind.annotation.RequestParam; public class TestController { @GetMapping("/greeting") + @RegisterReflectionForBinding(IndexModel.class) public String index(@RequestParam(defaultValue = "world") String name, Model model) { model.addAttribute("model", new IndexModel("Hello", name)); return "index"; } @GetMapping("/authors") + @RegisterReflectionForBinding(Author.class) public String authors(Model model) { model.addAttribute("authors", List.of(new Author("Brian Goetz"), new Author("Joshua Bloch"))); return "authors"; diff --git a/thymeleaf-webmvc/src/main/java/com/example/thymeleaf/webmvc/TestController.java b/thymeleaf-webmvc/src/main/java/com/example/thymeleaf/webmvc/TestController.java index ba9bc6f0..f1ad218d 100644 --- a/thymeleaf-webmvc/src/main/java/com/example/thymeleaf/webmvc/TestController.java +++ b/thymeleaf-webmvc/src/main/java/com/example/thymeleaf/webmvc/TestController.java @@ -2,6 +2,7 @@ package com.example.thymeleaf.webmvc; import java.util.List; +import org.springframework.aot.hint.annotation.RegisterReflectionForBinding; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -14,12 +15,14 @@ import org.springframework.web.bind.annotation.RequestParam; public class TestController { @GetMapping("/greeting") + @RegisterReflectionForBinding(IndexModel.class) public String index(@RequestParam(defaultValue = "world") String name, Model model) { model.addAttribute("model", new IndexModel("Hello", name)); return "index"; } @GetMapping("/authors") + @RegisterReflectionForBinding(Author.class) public String authors(Model model) { model.addAttribute("authors", List.of(new Author("Brian Goetz"), new Author("Joshua Bloch"))); return "authors";