Skip to content

Instantly share code, notes, and snippets.

@jianhe-fun
Created August 15, 2021 16:29
Show Gist options
  • Save jianhe-fun/2c8b810662169e1abed44313b63d94b3 to your computer and use it in GitHub Desktop.
Save jianhe-fun/2c8b810662169e1abed44313b63d94b3 to your computer and use it in GitHub Desktop.
Owner Controller Gist
package jian.he.controllers;
import jian.he.services.OwnerService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class OwnerController {
private final OwnerService ownerService;
public OwnerController(OwnerService ownerService) {
this.ownerService = ownerService;
}
@GetMapping({"/owners","/owners/index","/owners/index.html"})
public String listOwners(Model model){
model.addAttribute("owners",ownerService.findAll());
return "owners/index";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment