Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Controller
- public class HomeController {
- private ItemRepository itemRepository;
- @Autowired
- public HomeController(ItemRepository itemRepository){
- this.itemRepository = itemRepository;
- }
- @GetMapping("/")
- public String start(){
- return "redirect:home";
- }
- @GetMapping("/home")
- public String main(Model model){
- List<Item> list = itemRepository.findAll();
- model.addAttribute("items", list);
- return "home";
- }
- }
Add Comment
Please, Sign In to add comment