Arquivo da tag: Spring Dependency Injection & Auto-wiring

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:

@RequestMapping("/some/path")
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

Enjoy
Marcos Carvalho