REST Annotations Flashcards
1
Q
@RestController
A
Combines @Controller and @ResponseBody, meaning each method in the class returns a JSON/XML response directly (no view is rendered).
@RestController
public class MyRestController {
// Methods to handle HTTP requests
}
2
Q
@RequestMapping
A
Maps HTTP requests to handler methods in classes or methods.
Works at both the class and method level.