Fix Thymeleaf samples
Require https://github.com/oracle/graalvm-reachability-metadata/pull/69 to work.
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user