1)如果只是使用@RestController注解Controller,
get请求的话,则Controller中的方法不会通过配置的视图解析器InternalResourceViewResolver到templates下面查找页面,返回的内容就是Return 里的内容。
例如:请求处理方法return "demo",本来应该到demo.html,则浏览器页面显示demo.
post请求的话,会json的形式向浏览器返回数据
2)用@Controller注解controller,则Controller中的方法返回通过配置的视图解析器InternalResourceViewResolver到templates下面查找页面并在浏览器中显示
例如:请求处理方法return "demo",则浏览器链接到demo.html
但是如果请求处理方法返回的是一个json方式的数据,需要用@ResponseBody注解请求处理方法