October 2018
Intermediate to advanced
982 pages
23h 29m
English
The key to getting the service exposed to web requests is the @RestController annotation. This is yet another example of a meta-annotation or a convenience annotation, as the Spring documentation refers to it at times, which we have seen in previous recipes. In @RestController, two annotations are defined: @Controller and @ResponseBody. So we could just as easily annotate BookController, as follows:
@Controller
@ResponseBody
@RequestMapping("/books")
public class BookController {...}
Let's take a look at the following annotations from the preceding code snippet:
Read now
Unlock full access