Annotations Flashcards
@RequestMapping
It is used on Class and method level to map web requests onto specific handler classes and handler methods
@Controller
It is used to indicate that the class is a Spring controller
@RequestParam
It is used to request handler method arguments.
sometimes the parameters come from request URL.
@RequestBody(“/uploads/{username}”)
@Component
It is used on classes to indicate it as Spring Component
@Repository
It is used on classes which directly access the database or DAO
@Override
It is used on method and overrides the method that is inherited from
@ResponseBody
It indicates that the result type should be written straight in the response body in JSON or XML format.
@RequestMapping at method level
It will give URI on which handler methods will be executed.
@RequestMapping(method = RequestMethod.GET)
@RequestBody
It indicates that a method parameter should be bound to the value of the HTTP request body.
Why @Qualifier used with @Autowired
It narrows down the required bean
@Service
It is used on class to indicate that it performs some service
@RequestMapping at class level
It creates a base URI for which the controller is used.
@RequestMapping(“/uploads”)
@Configuration
It is used on classes which defines beans in it
@Bean
It is used at method level and creates beans
@GetMapping
It is used for mapping HTTP GET requests
It is short cut for @RequestMapping(method = RequestMethod.GET)