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
this is printing .model.memory address instead of showing list data like ur console
edit – i have to manually set the to string constructor overriding the lobok’s ToString which was useless i dont know how