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

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.

主站蜘蛛池模板: 怀来县| 利辛县| 涟源市| 莱州市| 永顺县| 泉州市| 虎林市| 奉化市| 卓资县| 宁国市| 北宁市| 藁城市| 吉隆县| 崇义县| 微博| 横山县| 江陵县| 黑龙江省| 通榆县| 鹿邑县| 北票市| 东阿县| 双流县| 鹿泉市| 岱山县| 岳池县| 清水县| 柳州市| 怀柔区| 安图县| 姜堰市| 逊克县| 蒙城县| 惠来县| 湘西| 杨浦区| 寿光市| 筠连县| 苍山县| 泰宁县| 克山县|