- 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.
推薦閱讀
- Objective-C應用開發全程實錄
- Vue.js入門與商城開發實戰
- C語言程序設計基礎與實驗指導
- Elasticsearch for Hadoop
- Mastering JBoss Enterprise Application Platform 7
- RabbitMQ Cookbook
- Swift語言實戰精講
- Building Microservices with .NET Core
- Python程序設計與算法基礎教程(第2版)(微課版)
- 零基礎學Python編程(少兒趣味版)
- Everyday Data Structures
- Django 5企業級Web應用開發實戰(視頻教學版)
- 從零開始學Selenium自動化測試:基于Python:視頻教學版
- AI自動化測試:技術原理、平臺搭建與工程實踐
- Java Web開發教程:基于Struts2+Hibernate+Spring