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

 springBoot报错是这样的

This application has no explicit mapping for /error, so you are seeing this as a fallback.报错解决_第1张图片

解决办法:

方法一:类使用@RestController注解 

This application has no explicit mapping for /error, so you are seeing this as a fallback.报错解决_第2张图片

方法二:使用与 @RestController效果一样的@Controller加 @ResponseBody

This application has no explicit mapping for /error, so you are seeing this as a fallback.报错解决_第3张图片

然后就能正常访问页面

This application has no explicit mapping for /error, so you are seeing this as a fallback.报错解决_第4张图片

 

第二个bug :return “index”,页面会出现index字符串,而不是index.html,当时写法是这样

This application has no explicit mapping for /error, so you are seeing this as a fallback.报错解决_第5张图片

解决办法一:

This application has no explicit mapping for /error, so you are seeing this as a fallback.报错解决_第6张图片

解决办法二:

This application has no explicit mapping for /error, so you are seeing this as a fallback.报错解决_第7张图片

 

如果对你有用的话,可以点个赞,让更多为bug苦恼的人看到这文章,谢谢!

你可能感兴趣的:(SpringBoot)