Spring|Spring Boot MVC api返回的String无法关联到html页面
之前没搞明白@RestController和@Controller的区别.....所以用了@RestController, 导致跳不到视图.
两者的区别如下:
-
@Controller
is used to mark classes as Spring MVC Controller. -
@RestController
is a convenience annotation that does nothing more than adding the @Controller and @ResponseBody annotations
@ResponseBody 表示该方法的返回不会被解析为跳转, 而是直接写入http响应正文
【Spring|Spring Boot MVC api返回的String无法关联到html页面】原文: https://stackoverflow.com/questions/25242321/difference-between-spring-controller-and-restcontroller-annotation
@ResponseBody参考文档: http://blog.csdn.net/ff906317011/article/details/78552426
推荐阅读
- Activiti(一)SpringBoot2集成Activiti6
- SpringBoot调用公共模块的自定义注解失效的解决
- 解决SpringBoot引用别的模块无法注入的问题
- 2018-07-09|2018-07-09 Spring 的DBCP,c3p0
- spring|spring boot项目启动websocket
- Spring|Spring Boot 整合 Activiti6.0.0
- Spring集成|Spring集成 Mina
- springboot使用redis缓存
- Spring|Spring 框架之 AOP 原理剖析已经出炉!!!预定的童鞋可以识别下发二维码去看了
- Spring|Spring Boot之ImportSelector