springboot踩過的坑


2019/3/29

java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getHttpServletMapping()Ljavax/servlet/http/HttpServletMapping;

SpringBoot2.x內置的tomcat9,tomcat9使用的是servletAPI v4

但是SpringBoot 2.x還包含着 servletAPI v3.1

解決方法:將tomcat版本改為8.5.37即可

<tomcat.version>8.5.37</tomcat.version>

2019/3/29

SpringBoot2.x 攔截器不再默認通行靜態頁面,需要自己將靜態頁面放行

.excludePathPatterns("/static/**")

 2019/4/11

關於thymeleaf使用時間戳格式化的問題 comment.created必須是long類型的時間戳,整形不可以,字符串也不可以。

th:text="${#dates.format(comment.created, 'yyyy-MM-dd HH:mm:ss')}

 2019/4/19

關於thymeleaf的這個異常

“xxx”,template might not exist or might not be accessibl

出現很多次了,加上@responseBody注解即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM