July 2018
Intermediate to advanced
268 pages
7h 36m
English
We have one controller class, which exposes just one method (we can extend it further to expose more APIs). This method lists all the movies in the hardcoded movie list under a URL, /movie, as shown in the following code snippet:
@RestControllerpublic class MovieController { @RequestMapping(value = "/movie", method = RequestMethod.GET) @ResponseBody @PreAuthorize("#oauth2.hasScope('movie') and #oauth2.hasScope('read')") public Movie[] getMovies() { initIt();//Movie list initialization return movies; } //…}
We are using a Movie model class utilizing all the features of the lombok library, as shown in the following code snippet:
@Data@ToString@Builder@NoArgsConstructor@AllArgsConstructorpublic class Movie { private Long id; ...Read now
Unlock full access