@RestController简单粗暴的理解就是@RestController=@Controller+@ResponseBody
下图所示为测试结果
效果跟@Controller+@ResponseBody是一样的
另外
This code uses Spring 4’s new @RestController annotation, which marks the class as
a controller where every method returns a domain object instead of a view. It’s shorthand for
@Controller and @ResponseBody rolled together.
上面是官网的解释
由上面可见,@RestController=@Controller+@ResponseBody