springboot访问页面报错:This application has no explicit mapping for /error, so you are seeing this as a fa
今天闲来无事,自己搭建一个springboot做个小例子,但在访问页面时报错了:This application has no explicit mapping for /error.....
找了好久,才发现原因,Application启动类放的位置不对要将Application放在最外层,也就是要包含所有子包。
看图说话:
一开始是这样的:
改过之后是这样的:
总结:比如你的groupId是com.google,子包就是所谓的com.google.xxx,所以要将Application类要放在com.google包下。springboot会自动加载启动类所在包下及其子包下的所有组件.