Close
« Tutorial

Spring MVC - HTTP PATCH with JSON Body MCQ

0/13
0 ✓
0 ✗

1. What is the HTTP PATCH method mainly used for?

2. Which annotation maps a controller method to HTTP PATCH requests in Spring MVC?

3. Which annotation should be placed before the parameter so that the JSON body of a PATCH request is converted to a Java object?

@PatchMapping("/items/{id}")
@ResponseBody
public String update(/* annotation here */ Item item) {
    return "Updated";
}

4. Which request header tells Spring MVC that the request body contains JSON data?

5. Which Spring MVC component converts a JSON request body into a Java object?

6. Which library is commonly added to the classpath so Spring MVC can convert JSON to Java objects?

7. What usually happens if a JSON body is sent to a method using @RequestBody but no JSON library is on the classpath?

8. Which annotation on a configuration class enables Spring MVC with its default message converters?

9. A controller method returns a String that should be sent directly as the response body, not used as a view name. Which annotation is needed?

10. How does Jackson usually match the fields of a JSON body to a Java object?

11. A normal HTML form can only send GET and POST requests. How can a web page send a PATCH request with a JSON body?

12. A PATCH mapping uses the URL /articles/{id}. Which annotation reads the id value from the URL?

Join