启动SpringBoot项目,输入localhost:8080/index/hi

页面显示为:
Spring Boot Controller访问不了页面
检查代码发现
Controller层代码,用了@RestController注解,它相当于@ResponseBody + @Controller合在一起的作用,返回的就是一个字符串
Spring Boot Controller访问不了页面
解决办法:
将注解换成Controller,即可。

相关文章:

猜你喜欢
相关资源
相似解决方案