@Controller public class BucketController { private final BucketService bucketService; public BucketController(BucketService bucketService) { this.bucketService = bucketService; } @GetMapping("/bucket") public String aboutBucket(Model model, Principal principal){ if (principal == null){ model.addAttribute("bucket", new BucketDto()); }else { BucketDto bucketDto = bucketService.getBucketByUser(principal.getName()); model.addAttribute("bucket", bucketDto); } return "bucket"; } }
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"> Bucket Your bucket All sum -> 1000
href="@{/bucket}"
th:href="@{/bucket}"
Контроллер Вьюха
вставка в меню
https://github.com/sergeshein/TestHiber