- 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.
推薦閱讀
- scikit-learn Cookbook
- TensorFlow Lite移動端深度學(xué)習(xí)
- ASP.NET MVC4框架揭秘
- 數(shù)據(jù)結(jié)構(gòu)和算法基礎(chǔ)(Java語言實(shí)現(xiàn))
- Mastering phpMyAdmin 3.4 for Effective MySQL Management
- Python機(jī)器學(xué)習(xí)編程與實(shí)戰(zhàn)
- Python Data Analysis Cookbook
- Getting Started with LLVM Core Libraries
- OpenGL Data Visualization Cookbook
- Java網(wǎng)絡(luò)編程實(shí)戰(zhàn)
- Spring Security Essentials
- 工業(yè)機(jī)器人離線編程
- 零基礎(chǔ)看圖學(xué)ScratchJr:少兒趣味編程(全彩大字版)
- Getting Started with Electronic Projects
- Tkinter GUI Programming by Example