Whitelabel Error Page -----This application has no explicit mapping for /error, so you are seeing this as a fallba
阿新 • • 發佈:2021-08-03
出現這個異常說明了跳轉頁面的url沒有對應的值:
第一點:
Application啟動類的位置不對.要將Application類放在最外側,即包含所有子包
原因:spring-boot會自動載入啟動類所在包下及其子包下的所有元件.
第二點:
在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
第三點:
控制器的URL路徑書寫問題
@RequestMapping(“xxxxxxxxxxxxxx”)
實際訪問的路徑與”xxx”不符合.
如果使用的shiro框架:其第三點配置
#暴露session的屬性
spring.freemarker.expose-session-attributes=true
#配置為傳統模式,空白值的處理
spring.freemarker.settings.classic_compatible=true
#重新指定模板檔案字尾 springboot 2.2.x後 預設字尾為 .ftlh
spring.freemarker.suffix=.ftl
spring.freemarker.template-loader-path=classpath:/templates/