@RestController 注解相当于 @Controller 与 @ResponseBody 合在一起使用。
如果使用
@RestController注解,那么Controller中的方法无法跳转jsp页面,或者html,视图解析器InternalResourceViewResolver也不起作用,返回的内容就是return里的内容。如果在一个Controller中,既有 跳转到页面的方法,又有返回JSON的方法,则需要在类上用
@Controller注解,配合视图解析器InternalResourceViewResolver才行。
在返回JSON的方法上,加上@ResponseBody注解。
感谢文章
https://www.cnblogs.com/shuaifing/p/8119664.html