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

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.

主站蜘蛛池模板: 华安县| 长宁区| 镇远县| 湖南省| 东丰县| 崇州市| 朝阳市| 大冶市| 黄陵县| 东乌| 淮滨县| 富民县| 尚义县| 吴江市| 慈利县| 定日县| 东莞市| 遵义县| 阿拉尔市| 乌拉特中旗| 洛宁县| 莆田市| 新乡县| 尤溪县| 佳木斯市| 遂昌县| 临安市| 澎湖县| 大竹县| 金寨县| 临沧市| 西乌| 乐安县| 文化| 应城市| 门头沟区| 广水市| 玛沁县| 锡林浩特市| 东源县| 股票|