javascript
Spring Boot异常
1、使用thymeleaf模板異常
項目在myeclipse啟動后訪問正常,但是打包成jar后,啟動后訪問頁面異常,異常信息如下
異常信息:template might not exist or might not be accessible by any of the configured Template Resolvers
解決方法:把路徑前面的斜杠去掉
例如
@RequestMapping(value="/admin",method = RequestMethod.GET)
public String mainPage(HttpServletRequest request,HttpServletResponse response,Model model){
try{
? ? if(request.getSession().getAttribute("messageName")==null)
? ? ? ? response.sendRedirect("http://"+WeiXinBUS.weixin_web_url+"/adminLogin.html");
}
catch(Exception e){e.printStackTrace();}
? ? model.addAttribute("username",request.getSession().getAttribute("messageName"));//將用戶名保存到參數中
? ??//return "/administer/administer"; //myeclipse上啟動訪問正常,打包成jar后啟動訪問報錯
? ? return "administer/administer"; //去掉斜杠‘/’后jar啟動訪問就可以正常了
}
?
轉載于:https://www.cnblogs.com/lmq-1048498039/p/8094670.html
總結
以上是生活随笔為你收集整理的Spring Boot异常的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何使用Java Enum
- 下一篇: 前端开发VScode常用插件