Arquivo da tag: Java Annotations

Notes about Spring Dispatcher

Which of the following are true of Java annotations?
They can be used to provide metadata for methods and other Java constructs.

 

Which of the following are true statements regarding the Spring DispatcherServlet?
It is used to route requests to Spring Controller objects.
It can invoke different methods on a Controller object depending on the request path.

 

Which of the following are uses of the @RequestBody annotation?
To indicate to Spring that the body of an incoming HTTP request should be unmarshalled to provide the value for a parameter of a method annotated with @RequestMapping.

 

@RequestParam can be used if the HTTP request has a multipart body.

 

Which of the following are true of @ResponseBody?
@ResponseBody helps to decouple Controller method logic from HTTP-specific protocol details.
@ResponseBody indicates that the return value from a Controller method should be used to produce the body of the HTTP response.

 

Which of the following are true statements about an Application class, such as the Application class in the examples?
It can be used to provide configuration information to Spring.
It does not have to inherit from a Spring-specific super class.
With Spring Boot and the appropriate annotations, it can be used to setup a Dispatcher servlet.
It can provide a main() method to launch Spring Correct.

 

Which of the following are true statements about JSON?
It can be used to express the state of a Java object.
It can be used to express arrays of objects.
It is a text-based format.

 

Enjoy
Marcos Carvalho