Week3Quiz Flashcards
The @ExceptionHandler can be used to
Provide a handler for a given exception, provided it is thrown by the controller.
@GetMapping(“/{id}”)
public Object geTById(@PathVariable int id){}
Spring is
A dependency injection framework for Java
One of the problems Spring Core addresses
Tight coupling
A Spring bean is
A class which is constructed and managed by Spring
Which is NOT stereotype annotation? @Component @Bean @Controller @Service
@Bean
Which of these is the @Configuration annotation used for?
- Provide XML configuration
- Define a class as a configuration bean
- Provide annotation driven configuration
- Do the same as @Autowired
Define a class as a configuration bean.
When requesting a bean with scope “prototype”, you will always be given a new instance of the bean? (T/F)
true
The default scope of a bean is “singleton” (T/F)
true
The @RequestMapping annotation is used to
- Provide a URL mapping to a resource for any HTTP method.
- Provide a URL mapping to a resource for only GET methods.
- Map a path variable to an array index.
- Provide data contained in a request body as a HashMap.
Provide a URL mapping to a resource for any HTTP method
@RequestBody annotation is used for which of these?
- Define a class as a controller.
- Define that the return value of a method should be serialized to some form such as XML, JSON, ect.
- Define that the request body should be deserialized to a Java object from form such as XML, JSON, ect.
- Parse the a variable in the requested URL and injected to the method call as a parameter.
Define that the request body should be DEserialized to a Java object from form such as XML, JSON, ect.
@PathVariable annotation is used to
Parse a variable in the requested URL and inject it into the method call as a parameter.
When used on the class, the @RestController annotation implies what on all methods? @ReponseBody @RequestBody @RequestMapping @RequestParam
@ReponseBody
Configuring a method to handle an HTTP PUT request: @PutRequest @Put @PutMapping @RequestMapping("PUT")
@PutMapping
Springboot features an “opinionated” configuration which means;
When not provided with configurations, it uses a reasonable default config
When using spring boot, you must deploy your application to a Tomcat server. (T/F)
false
Configuration can be provided to spring using which files?
- application.xml and application.yml
- application.properties and application.xml
- application.xml and bootstrap.xml
- application.yml and application.properties
application.yml and application.properties
Using the default configuration, Spring boot includes an embedded..:
- tomcat server
- postgres server
- in memory database
- user
tomcat server
Spring boot actuators can be used to
get runtime info about the application via HTTP
Spring Data requires some underlying ORM technology like Hibernate. (T/F)
true