springboot @RestController 和@Controller的区别
1)如果只是使用@RestController注解Controller,则Controller中的方法无法返回jsp页面或者html页面,配置的视图解析器InternalResourceViewResolver不起作用,返回的内容就是Return里的内容。
例如:本来应该到index.html页面的,则其显示index
2)如果需要返回到指定页面,则需要用@Controller注解
3)使用@controller注解时,如果需要返回JSON,XML内容到页面,则需要在对应的方法上加上@ResponseBody注解,或者使用ModelAndView视图解析器。