Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
404 views
in Technique[技术] by (71.8m points)

java - How to solve 500 Internal Server Error in Swagger UI,service is not running

Service is compiling but shows error 500 in swagger ui and not giving output help! Below are controller, service,implementation codes ,please help me get through this. Rest all services are working fine

controller

@ApiOperation(value="Returns all bookings")                                             //Operation to view all bookings
    @ApiResponses(value= {
            @ApiResponse(code=201, message="All Bookings found"),
            @ApiResponse(code=404, message="No such booking found")
    })
    @GetMapping(value = "/booking/all", produces = MediaType.APPLICATION_JSON_VALUE)  
    public List<Booking> getAllBooking() throws BookingNotFoundException {
        logger.info("View all booking service started..");
        return bookingService.getAllBookings();
    }
    

Service Implementation

@Override
public List<Booking> getAllBookings() {
    return  BookingUtil.convertBookingEntityListIntoBookingList(bookingRepo.findAll());
}

Service

         public List<Booking> getAllBookings();

util

public  static BookingEntity convertBookingIntoBookingEntity(Booking booking) 
{
    return new BookingEntity(booking.getJourneyDate(),booking.getBookingDate(),booking.getCancelDate(),
            booking.getFare(),booking.getBookingStatus(),booking.getVehicleType(),RouteUtil.convertRouteIntoRouteEntity(booking.getRoute()),
            UserUtil.convertUserIntoUserEntity(booking.getUser()));
}

public  static Booking convertBookingEntityIntoBooking(BookingEntity bookingEntity)
{
    return new Booking(bookingEntity.getBookingId(),bookingEntity.getJourneyDate(),bookingEntity.getBookingDate()
            ,bookingEntity.getCancelDate(),bookingEntity.getFare(),bookingEntity.getBookingStatus(),
            bookingEntity.getVehicleType(),RouteUtil.convertRouteEntityIntoRoute(bookingEntity.getRoute()),
            UserUtil.convertUserEntityIntoUser(bookingEntity.getUser()));
}

public static List<Booking> convertRouteEntityListIntoBookingList(List<BookingEntity> bookingEntityList) {
    List<Booking> booking = new ArrayList<Booking>();
    for(BookingEntity bookingEntity: bookingEntityList) {
        booking.add(convertBookingEntityIntoBooking(bookingEntity));
    }
    return booking;
}



public  static List<Booking> convertBookingEntityListIntoBookingList(List<BookingEntity> bookingEntityList)
{
    List<Booking> bookings = new ArrayList<Booking>();
    for(BookingEntity bookingEntity: bookingEntityList) {
        bookings.add(convertBookingEntityIntoBooking(bookingEntity));
    }
    return bookings;
}

}


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...