最近寫了一個管理員後臺的web微服務,今天準備部署到阿里雲上,但是訪問頁面出現了
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue Mar 05 16:32:39 CST 2019
There was an unexpected error (type=Internal Server Error, status=500).
Error resolving template "/user/user-list", template might not exist or might not be accessible by any of the configured Template Resolvers
這個錯誤!玩過springboot的大佬們對這個錯誤已經不陌生了。然而我在IDEA上開發好好的,怎麼到服務器就不行了?我感覺是環境問題,然後我又打了一個jar運行在本機windows環境,然而還是這個錯誤!!
我發現首頁是好的,並且我是通過“/”轉發到首頁的,所以這個方法是正確的!然後我有看了一下別的請求方法,大家對比看一下有什麼區別:
在轉發的時候return前面加“/”的時候打成jar的時候找不到html頁面!
下面廢話少說,寫出解決方案:
把轉發的地址改爲 return "user/user-list";就可以了。