版权声明:本文为博主原创,转载请留言并标明出处 https://blog.csdn.net/qq_36355271/article/details/88687334
常用Spring MVC 的同学一定知道正常注解就可以使用连接访问html或者jsp的UI页面,但是刚开始用是springboot 始终只能返回文字,不能解析UI.
当然问题还是出在注解错误,说明对注解@Controller和@RestController没有完全理解,
springMVC 使用@Controller
springboot 使用@RestController(他相当于@Controller 加上 @ResponseBody)
所有解决办法很简单 在要显示UI的controller中注解用@Controller 就可以
还有一个注意点:如果使用 thymeleaf
html文件必须在 templates下,否则获取不到。 如果没有使用则放在static下