@RequestMapping(value = "/api/cacheFlightSearch", method = RequestMethod.GET) public String cacheFlightSearch( @RequestParam("departureDate") String departureDate, @RequestParam("departureAirport") String departureAirport) { DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ISO_DATE; LocalDate depDate = LocalDate.parse(departureDate, DATE_FORMAT); LocalDate returnDate = depDate.plusDays(7); String retDate = returnDate.format(DATE_FORMAT); List<Destination> destinations = new Destinations().getDestinations(); for (Destination destination : destinations) { String arrivalAirportCode = destination.getAirportCodes().get(0); System.out.println( "Getting best flight price for destination: " + arrivalAirportCode + "," + destination.getCity()); flightSearchService.getFlights(departureDate, departureAirport, arrivalAirportCode, retDate); System.out.println( "Finished processing best flight price for destination: " + arrivalAirportCode + "," + destination.getCity()); } return "success"; }