springmvc 中@Controller和@RestController的区别

如题所述

第1个回答  2017-05-09
官方文档中有介绍:
@RestController is a stereotype annotation that combines @ResponseBody and @Controller.
也就是说
@RestController注解相当于@ResponseBody、@Controller这两个注解的结合。
所以在定义Controller的时候如果需要返回jsp界面就用@Controller注解,只需要返回string或json的时候就用@RestController注解。

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网