0
@Repository
public interface RoomRepository extends CrudRepository<Room, Long>{
Room findByNumber(String number);
}
我上面如何春季開機初始化庫
@Service
public class ReservationService {
private RoomRepository roomRepository;
private GuestRepository guestRepository;
private ReservationRepository reservationRepository;
@Autowired
public ReservationService(RoomRepository roomRepository, GuestRepository guestRepository, ReservationRepository reservationRepository) {
this.roomRepository = roomRepository;
this.guestRepository = guestRepository;
this.reservationRepository = reservationRepository;
}
我的服務類RoomRepository如上圖所示。爲什麼可以初始化一個接口?謝謝
也許你可以找到答案這裏http://stackoverflow.com/questions/33999879/spring-data-autowire-the-repository-interfaces-directly –
的可能的複製[如何是春數據倉庫實際執行?](http://stackoverflow.com/questions/38509882/how-are-spring-data-repositories-actually-實現) – dunni