Arquivo da categoria: Spring

Notes About Clouds

Which of the following are reasons that username/password logins and session cookies are not ideal for mobile clients?
It isn’t possible to easily revoke access to a single app
Changing your password can revoke access to every app that uses it

Which of the following analogies is most appropriate for describing OAuth 2.0?
A valet key for a car

What is the purpose of a password grant in OAuth 2.0?
To obtain a token required for access to one or more resources on the system
To authenticate the user

How is a bearer token used?
It is provided in the Authorization header of a request to prove a client’s identity

Which of the following is an example of horizontal scaling?
Adding a new server to support additional load for an application

Which of the following are accurate statements about stateless applications?
They typically allow requests to be routed to any node running an application instance

What is auto-scaling?
Automated addition or removal of computing resources to adapt to changes in an application’s load, failures, etc.

Marcos Carvalho

Notes About Spring e Retrofit

Which of the following are true statements about the Retrofit library?
It can be used to provide strong typing for interactions with HTTP-based cloud services
It can automatically marshall Java objects into HTTP request bodies

Which of the following are reasons to use dependency injection?
To reduce the amount of manually written configuration code that is needed to “wire” an application together
To help decouple one or more classes from their dependencies

What is @Autowired used for?
To indicate that one or more of a class’ dependencies should be automatically provided through dependency injection

Which of the following are true of object relational mapping?
It is used to aid in persisting instances of Java objects into a database

Which of the following statements are true of the code shown below:

public @ResponseBody List<Video> findVideos(@RequestParam("title") String videoTitle){
String query = "select * from video where video.title = '"+videoTitle+"'";
return executeDatabaseQuery(query)

@RequestParam will NOT filter the title parameter and the code could suffer from an SQL injection attack
Arbitrary logic could potentially be injected into the query

Which of the following are true of Spring JPA Repositories?
The implementations of repository interfaces are automatically created by Spring

Marcos Carvalho

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.


Marcos Carvalho