1. Which annotation completes this handler method so it accepts HTTP PUT requests?
// Add annotation here
public String update() { ... }
Why:@PutMapping maps HTTP PUT requests to a handler method. Annotations such as @UpdateMapping and @ReplaceMapping do not exist in Spring MVC.
2. Which annotation tells Spring MVC to convert the HTTP request body into a method parameter?
Why:@RequestBody binds the HTTP request body to a method parameter, using an HttpMessageConverter to deserialize the payload.
3. Which HTTP request header tells the server that the request body is in XML format?
Why: The Content-Type header specifies the media type of the request body. For an XML body, clients typically send application/xml.
4. What Content-Type value should a client send with an XML body?
Why: The media type application/xml indicates that the request body contains XML data.
5. Which Spring component converts an XML request body into a Java object?
Why: An HttpMessageConverter reads incoming request bodies into Java objects and writes outgoing objects to response bodies.
6. What must be on the classpath so Spring MVC can convert XML to Java objects using Jackson?
Why: Spring MVC registers a Jackson XML message converter when an XML data format library such as jackson-dataformat-xml is present on the classpath.
7. How does Spring MVC choose the converter to read a request body?
Why: Spring MVC selects an HttpMessageConverter that supports both the request's Content-Type media type and the target parameter's Java type.
8. Which HTTP status code does Spring MVC typically return when no converter supports the request's Content-Type?
Why: When no converter supports the incoming media type, Spring MVC rejects the request with 415 Unsupported Media Type.
9. Which HTTP methods can a standard HTML form submit directly?
Why: Standard HTML forms only support GET and POST. Sending a PUT request with an XML body from a browser requires client-side code such as fetch or XHR.
10. What is an HTTP PUT request normally used for?
Why: HTTP PUT sends a representation to a target URI to create the resource if it does not exist or replace it if it does.
11. Which annotation reads the id value from a URL template like /items/{id}?
Why:@PathVariable extracts a URI template variable such as {id} and binds it to a method parameter.
12. What does @ResponseBody do on a handler method?
Why:@ResponseBody instructs Spring MVC to serialize the return value into the HTTP response body rather than resolving a view name.
13. How does Jackson normally match XML elements to properties of a Java object?
Why: By default, Jackson matches XML element names to JavaBean/field property names—for example, <name> maps to a name property.
14. Which annotation on a configuration class enables Spring MVC features, including default message converters?
Why:@EnableWebMvc activates Spring MVC configuration and registers default HttpMessageConverter implementations for available libraries.
15. Which curl option sets the HTTP method to PUT?
Why: Use -X PUT to specify the PUT method, -H to set headers such as Content-Type: application/xml, and -d to supply the XML payload.