Controller 和 RestController的区别

贴一段代码 Controller =RestController+ResponseBody 如果只用Controller 不使用ResponseBody 会提示404

@Controller
public class HelloController {
    @ResponseBody
    @RequestMapping("/hello")
    public String hello(){
        return "Hello World!";
    }
}
@RestController
public class HelloController {
    @RequestMapping("/hello")
    public String hello(){
        return "Hello World!";
    }
}
posted @ 2019-07-26 11:52  童小哥总是不开心。  阅读(236)  评论(0编辑  收藏  举报