Annotations Flashcards

1
Q

@RequestMapping

A

It is used on Class and method level to map web requests onto specific handler classes and handler methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

@Controller

A

It is used to indicate that the class is a Spring controller

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

@RequestParam

A

It is used to request handler method arguments.
sometimes the parameters come from request URL.
@RequestBody(“/uploads/{username}”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

@Component

A

It is used on classes to indicate it as Spring Component

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

@Repository

A

It is used on classes which directly access the database or DAO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

@Override

A

It is used on method and overrides the method that is inherited from

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

@ResponseBody

A

It indicates that the result type should be written straight in the response body in JSON or XML format.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

@RequestMapping at method level

A

It will give URI on which handler methods will be executed.

@RequestMapping(method = RequestMethod.GET)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

@RequestBody

A

It indicates that a method parameter should be bound to the value of the HTTP request body.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why @Qualifier used with @Autowired

A

It narrows down the required bean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

@Service

A

It is used on class to indicate that it performs some service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

@RequestMapping at class level

A

It creates a base URI for which the controller is used.

@RequestMapping(“/uploads”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

@Configuration

A

It is used on classes which defines beans in it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

@Bean

A

It is used at method level and creates beans

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

@GetMapping

A

It is used for mapping HTTP GET requests

It is short cut for @RequestMapping(method = RequestMethod.GET)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

@Autowired

A

It injects object dependency implicitly

17
Q

@ExceptionHandling

A

It is used at Method level to handle exception at the controller level

18
Q

@ComponentScan

A

It allows Spring to know the packages to scan for the annotated components

19
Q

@PostMapping

A

It is used for mapping HTTP POST requests.

It is short cut for @RequestMapping(method = RequestMethod.POST)

20
Q

@PathVariable

A

It is used to request handler method arguments.

@PathVariable String xyz