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

The @RestController annotation

Pragya Keshap answered on May 3, 2022 Popularity 7/10 Helpfulness 2/10

Contents


More Related Answers

  • Add REST controller
  • How do you create a controller in Spring? @Controller vs. @RestController?
  • How do you create a controller in Spring? @Controller vs. @RestController?
  • Create a REST controller class
  • Build REST API's using Spring Boot - Important Spring MVC Annotations
  • The importance of SpringMVC in RESTful web services #
  • spring rest controller
  • spring boot rest annotations

  • The @RestController annotation

    0

    @RestController is a class-level annotation used for the resource class introduced in Spring 4. It is a combination of @Controller and @ResponseBody, and because of it, a class returns a domain object instead of a view.

    In the following code, you can see that the CalculationController class handles GET requests for /calculation by returning a new instance of the calculation class.

    We will implement two URIs for a Calculation resource—the square root (the Math.sqrt() function) as the /calculations/sqrt URI, and power (the Math.pow() function) as the /calculation/power URI.

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

    Closely Related Answers



    0

    The @RestController annotation helps you to add @ResponseBody and @Controller annotations to the class.

    You can also import org.springframework.web.bind.annotation package in your file.

    https://www.geeksforgeeks.org/spring-rest-controller/

    Popularity 9/10 Helpfulness 2/10 Language javascript
    Source: Grepper
    Tags: explain
    Link to this answer
    Share Copy Link
    Contributed on Jan 08 2023
    Anjali Sharma
    0 Answers  Avg Quality 2/10

    0
    Popularity 10/10 Helpfulness 2/10 Language java
    Source: Grepper
    Tags: java
    Link to this answer
    Share Copy Link
    Contributed on May 03 2022
    CRONOS
    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.