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注解即可

posted @ 2019-03-29 11:43  小zha  阅读(2691)  评论(0编辑  收藏  举报