@GetMapping("/blah")
@ResponseBody
public String getSomething() {
return "Hello";
}
View and Templating
@Controller // Defines the component used by DI
public class BookController {
@RequestMapping("/books") // Defines path
public String getBooks(Model model) { // The model is what we return, and thus needs enriching, which is used by the view layer
model.addAttribute("books", Set.of(new Book("blah", "foo", new Publisher("name")))));
return "books/list";// Refers to the template
}
}