package com.chantha.springdemo.controller; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.chantha.springdemo.model.Food; import com.chantha.springdemo.service.FoodService; @RestController @RequestMapping(value="/api/food") public class FoodController { @Autowired private final FoodService foodService; public FoodController(FoodService foodService) { super(); this.foodService = foodService; } @GetMapping public List findAllFoods(){ return foodService.findAllFoods(); } }