Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

The @RequestMapping annotation

Pragya Keshap answered on February 19, 2021 Popularity 6/10 Helpfulness 1/10

Contents


More Related Answers

  • requestmapping post
  • Explain @RestController annotation in Spring Boot?
  • @requestmapping({link/link1})
  • @requestmapping({link/link1})
  • @api operation spring boot
  • @RequestMapping annotations using only HTTP request types
  • What does Spring use HandlerMappings for?
  • What is the purpose of @RequestMapping?
  • What are the major differences between RequestMapping and GetMapping?
  • EventSourceMappingConfiguration
  • Build REST API's using Spring Boot - Important Spring MVC Annotations
  • Spring Boot and Web Annotations
  • @RequestPart annotation in SpringBoot
  • @RequestPart annotation in SpringBoot

  • The @RequestMapping annotation

    0

    The @RequestMapping annotation is used at class level to map the /calculation URI to the CalculationController class; that is, it ensures that the HTTP request to /calculation is mapped to the CalculationController class. Based on the path defined using the @RequestMapping annotation of the URI (postfix of /calculation, for example, /calculation/sqrt/144), it would be mapped to the respective methods. Here, the request mapping, /calculation/sqrt, is mapped to the sqrt() method, and /calculation/power is mapped to the pow() method.

    You might have also observed that we have not defined what request method (GET/POST/PUT, and so on) these methods would use. The @RequestMapping annotation maps all the HTTP request methods by default. You could use specific methods by using the method property of RequestMapping. For example, you could write a @RequestMethod annotation in the following way to use the POST method:

    Popularity 6/10 Helpfulness 1/10 Language java
    Source: Grepper
    Tags: java
    Link to this answer
    Share Copy Link
    Contributed on Feb 19 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10

    Closely Related Answers



    3
    Popularity 10/10 Helpfulness 4/10 Language whatever
    Link to this answer
    Share Copy Link
    Contributed on Feb 19 2021
    Motionless Meerkat
    0 Answers  Avg Quality 2/10

    0
    Popularity 8/10 Helpfulness 2/10 Language java
    Source: Grepper
    Tags: java
    Link to this answer
    Share Copy Link
    Contributed on Mar 06 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10

    0
    Popularity 1/10 Helpfulness 1/10 Language java
    Link to this answer
    Share Copy Link
    Contributed on Dec 30 2022
    Deepika Sahu
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.