- Mastering Microservices with Java
- Sourabh Sharma
- 93字
- 2021-07-02 13:03:31
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 (the Math.sqrt() function) as the /calculations/sqrt URI, and power (the Math.pow() function) as the /calculation/power URI.
推薦閱讀
- Testing with JUnit
- Learning ArcGIS Pro
- C語言程序設計實踐教程
- PhoneGap Mobile Application Development Cookbook
- Learning DHTMLX Suite UI
- 焊接機器人系統操作、編程與維護
- Test-Driven Development with Django
- Learning PHP 7
- Solutions Architect's Handbook
- Illustrator CS6設計與應用任務教程
- jQuery for Designers Beginner's Guide Second Edition
- Mastering Concurrency Programming with Java 9(Second Edition)
- Instant Apache Camel Messaging System
- 視窗軟件設計和開發自動化:可視化D++語言
- Drupal 8 Development:Beginner's Guide(Second Edition)