@Controller And @RestController
@Controller And @RestController The difference between
1 The latter cannot return jsp page , @RestController yes @Controller and @ResponseBody The combination of , The combined effect of two annotations .
2、 If you just use @RestController annotation Controller, be Controller The method in cannot be returned jsp page , Configured view parser InternalResourceViewResolver It doesn't work , What is returned is Return Contents of Li .
for example ： I should have been there success.jsp Page , Then it is displayed success.
3、 If necessary, return to the specified page , You need to use @Controller Coordinates with the view parser InternalResourceViewResolver Talent .
4、 If you need to go back JSON,XML Or custom mediaType Content to page , You need to add to the corresponding method @ResponseBody annotation .