Spring Web Services Exercise
The goal of this exercise is to create simple web services using existing JPA repositories. At a minimum, you should create two REST endpoints that can be used for future exercises.
Movie Cast Service
- Navigate to the file
microservice.workshop.moviecastservice.http.CastController
in themovie-cast-service
project - Add code to this class so that it will return a list of cast members for a given movie id
- You should inject the
CastMemberRepository
to gain access to the JPA repository for cast members - the REST URL should be
/cast/search?movieId=x
where x is a movie id
- You should inject the
- When you are finished, the tests in the class
microservice.workshop.moviecastservice.http.CastControllerTest
should pass. - You can also start the application and access the Swagger ui at http://localhost:8082
Movie Service
- Navigate to the file
microservice.workshop.movieservice.http.MovieController
in themovie-service
project - Add code to this class so that it will return a movie for a given movie id
- You should inject the
MovieRepository
to gain access to the JPA repository for cast members - the REST URL should be
/movie/x
where x is a movie id - If no movie exists, return a 404 (NOT_FOUND) status
- You should inject the
- When you are finished, the tests in the class
microservice.workshop.movieservice.http.MovieControllerTest
should pass. - You can also start the application and access the Swagger ui at http://localhost:8081