Hello, in this post we will call the expense service method to get the list of expenses and print it in the console. let’s begin. Inside the MasterController modify the handler method home()
MasterController.java
@Controller public class MasterController { @Autowired ExpenseService expenseService; @RequestMapping("/") public ModelAndView home() { ModelAndView mav = new ModelAndView("home"); mav.addObject("message", "List of expenses"); List<Expense> expenses = expenseService.findAll(); System.out.println(expenses); return mav; } }
That’s it for this post. I will see you in the next post!
Thanks
Bushan SC