Spring Boot Masterclass – Call service method and print data in console 07

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()


public class MasterController {
	ExpenseService expenseService;
	public ModelAndView home() {
		ModelAndView mav = new ModelAndView("home");
		mav.addObject("message", "List of expenses");
		List<Expense> expenses = expenseService.findAll();
		return mav;

That’s it for this post. I will see you in the next post!

Bushan SC

About the author

Bushan Sirgur

Hey guys, I am Bushan Sirgur from Banglore, India. Currently, I am working as an Associate project in an IT company.

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *