- Mastering Microservices with Java 9(Second Edition)
- Sourabh Sharma
- 91字
- 2021-07-02 21:54:45
The @RestController annotation
@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 (Math.sqrt() function) as the /calculations/sqrt URI, and power (Math.pow() function) as the /calculation/power URI.
推薦閱讀
- HTML5+CSS3+JavaScript從入門到精通:上冊(微課精編版·第2版)
- 新編Visual Basic程序設計上機實驗教程
- SPSS數據挖掘與案例分析應用實踐
- Advanced Machine Learning with Python
- Spring Boot開發與測試實戰
- 零起步玩轉掌控板與Mind+
- Java應用開發與實踐
- 認識編程:以Python語言講透編程的本質
- 深入淺出Android Jetpack
- 老“碼”識途
- Building Serverless Applications with Python
- Learning Concurrent Programming in Scala
- Webpack實戰:入門、進階與調優(第2版)
- Learning Splunk Web Framework
- Python Programming for Arduino