1.报错信息
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Mon Mar 05 12:11:00 CST 2018
There was an unexpected error (type=Not Found, status=404).
No message available
2.原因
直接右键点击运行Application类,在非Web应用中可能不会有什么问题,但是在Web应用中会报404错误。
因为直接运行当前启动类,Spring Boot无法找到当前页面资源。
因此,基于Spring Boot的应用开发调试时,一定要基于Spring Boot提供的Spring-boot-maven-plugin插件命令来运行应用或者通过Spring Boot命令行(参照 http://blog.youkuaiyun.com/zane3/article/details/73729717)来运行该应用。
参照 《精通Spring 4.x 企业应用开发实战》P67 实战经验