1. 程式人生 > >1. SpringBoot啟動後,報異常:This application has no explicit mapping for /error, so you are seeing this as a fallback.

1. SpringBoot啟動後,報異常:This application has no explicit mapping for /error, so you are seeing this as a fallback.

per 視圖解析 自動加載 cati strong PE 出現 bsp AR

出現這個異常說明了跳轉頁面的url無對應的值.

原因1:

Application啟動類的位置不對.要將Application類放在最外側,即包含所有子包
原因:spring-boot會自動加載啟動類所在包下及其子包下的所有組件.

原因2:

在springboot的配置文件:application.yml或application.properties中關於視圖解析器的配置問題:
當pom文件下的spring-boot-starter-paren版本高時使用:
spring.mvc.view.prefix/spring.mvc.view.suffix
當pom文件下的spring-boot-starter-paren版本低時使用:
spring.view.prefix/spring.view.suffix

原因3:

控制器的URL路徑書寫問題
@RequestMapping(“xxxxxxxxxxxxxx”)
實際訪問的路徑與”xxx”不符合.

1. SpringBoot啟動後,報異常:This application has no explicit mapping for /error, so you are seeing this as a fallback.