idea+maven+springboot搭建web简单项目经历小计(RestController)

参考博主S_H_A_N的教程(http://blog.csdn.net/lom9357bye/article/details/69677120)

搭建完了之后,启动项目,本地浏览器打开页面报错:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Sat Mar 17 11:16:55 CST 2018
There was an unexpected error (type=Not Found, status=404).
No message available


最后查了半天,说是DemoApplication必须在父级包,改完了之后发现还是报错,最后找到了这个低级原因,注解引用的问题,

@Controller 的改成@RestController,它相当于@Controller+@ResponseBody.

最后问题解决了。

以此记录,已给自己提个醒!也希望能帮到更多的初学者。

猜你喜欢

转载自blog.csdn.net/genghongsheng/article/details/79590202