官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 原阳县| 岱山县| 民勤县| 安岳县| 高阳县| 卫辉市| 毕节市| 延长县| 榆社县| 台江县| 长宁区| 海南省| 婺源县| 任丘市| 寿阳县| 通山县| 蒲江县| 宾川县| 武安市| 丽江市| 昌平区| 凤阳县| 莱阳市| 翁源县| 大化| 云和县| 曲阳县| 大庆市| 佛坪县| 乌苏市| 福鼎市| 曲阳县| 托里县| 筠连县| 龙泉市| 丽水市| 河北省| 嘉黎县| 襄垣县| 金平| 团风县|