Привет, я недавно изучил весеннее облако с симулированным клиентом и eureka, но у меня возникли проблемы с открытием моего веб-приложения.
feign.FeignException $ NotFound: статус 404 чтение RoomReservationService # getRoomReservationsForDate (String)
and The error at
com.frankmoley.webapp.reservation.ReservationController.getReservations (ReservationController.java:42)
Вот мой код для RoomReservationService
package com.frankmoley.webapp.reservation.client;
import com.frankmoley.webapp.reservation.domain.Room;
import com.frankmoley.webapp.reservation.domain.RoomReservation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* Created by frankmoley on 5/23/17.
*/
@FeignClient("RESERVATIONBUSINESSSERVICES")
public interface RoomReservationService {
@RequestMapping(value = "/rooms", method = RequestMethod.GET)
public List<Room> getAllRooms(@RequestParam(name="roomNumber", required=false)String roomNumber);
@RequestMapping(value="/roomReservations/{date}", method=RequestMethod.GET)
public List<RoomReservation> getRoomReservationsForDate(@PathVariable("date") String date);
}
И My ReservationController
package com.frankmoley.webapp.reservation;
import com.frankmoley.webapp.reservation.client.RoomReservationService;
import com.frankmoley.webapp.reservation.domain.Room;
import com.frankmoley.webapp.reservation.domain.RoomReservation;
import io.micrometer.core.instrument.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;
@Controller
@RequestMapping(value="/reservations")
public class ReservationController {
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
private final RoomReservationService roomReservationService;
@Autowired
public ReservationController(RoomReservationService roomReservationService){
super();
this.roomReservationService = roomReservationService;
}
@RequestMapping(method= RequestMethod.GET)
public String getReservations(@RequestParam(value="date", required=false)String dateString, Model model){
String date = dateString;
if(StringUtils.isBlank(dateString)){
date = this.createTodayDateString();
}
List<Room> rooms = this.roomReservationService.getAllRooms("P1");
List<RoomReservation> roomReservations = this.roomReservationService.getRoomReservationsForDate(date);
model.addAttribute("roomReservations", roomReservations);
return "reservations";
}
public String createTodayDateString(){
return DATE_FORMAT.format(new Date());
}
}
Я искал где угодно, но не смог найти ответ. Пожалуйста, помогите мне