- 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.
推薦閱讀
- HornetQ Messaging Developer’s Guide
- Animate CC二維動(dòng)畫設(shè)計(jì)與制作(微課版)
- 64位匯編語言的編程藝術(shù)
- Java Web開發(fā)技術(shù)教程
- The DevOps 2.4 Toolkit
- 3D少兒游戲編程(原書第2版)
- SAP BusinessObjects Dashboards 4.1 Cookbook
- Python忍者秘籍
- 低代碼平臺(tái)開發(fā)實(shí)踐:基于React
- Java編程的邏輯
- Scala for Machine Learning(Second Edition)
- Cocos2d-x Game Development Blueprints
- 征服C指針(第2版)
- 深入理解Kafka:核心設(shè)計(jì)與實(shí)踐原理
- Node.js 6.x Blueprints