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

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.

主站蜘蛛池模板: 亳州市| 莱州市| 天门市| 长宁县| 奇台县| 西乡县| 泸西县| 赤峰市| 罗田县| 台东县| 木里| 宜兴市| 三门峡市| 华宁县| 富宁县| 维西| 安岳县| 石台县| 汉沽区| 大城县| 安龙县| 隆子县| 克东县| 赤城县| 从江县| 瑞金市| 澄城县| 徐州市| 颍上县| 翁牛特旗| 台南县| 吴桥县| 资溪县| 搜索| 施甸县| 甘德县| 东宁县| 东山县| 临澧县| 德钦县| 保定市|