Fix Thymeleaf samples

Require https://github.com/oracle/graalvm-reachability-metadata/pull/69 to work.
This commit is contained in:
Sébastien Deleuze
2022-09-29 17:37:30 +02:00
parent 1e2753b3e1
commit 4ff7cfefbc
2 changed files with 6 additions and 0 deletions

View File

@@ -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";

View File

@@ -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";