1. Controller, RestController的共同點
都是用來表示Spring某個類的是否可以接收HTTP請求
2. Controller, RestController的不同點
@Controller標識一個Spring類是Spring MVC controller處理器
@RestController: a convenience annotation that does nothing more than adding the@Controller
and@ResponseBody
annotations。 @RestController是@Controller和@ResponseBody的結合體,兩個標注合並起來的作用。
示例如下: