从永远到永远-博客开发项目踩坑实录

1、org.springframework.web.HttpRequestMethodNotSupportedException: Request method ‘POST’ not supported

十有八九不是因为请求方式的问题,而是因为前端传来的对象属性名与对象的属性名不一致!不信可以跟进区源码的Dispatcher Servlet看看。

2、Thymeleaf 解析不到,后端传来对象中的Boolean类型的属性!!!!!没有解决!!!
从永远到永远-博客开发项目踩坑实录

isPublishable是后端blog对象中定义的Boolean属性,访问该页面直接报错,非Boolean属性就没有问题!

org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field ‘isPublishable’ cannot be found on object of type ‘com.epo.blog.pojo.Blog’ - maybe not public or not valid?

3、所谓念念不忘,必有回响。我想我今天要解决2、这个问题了。
我一直以为是页面渲染的时候出现的问题,直到我今天司马当着活马医,又debug了一遍。发现可这个问题:
Method threw ‘java.lang.*Error’ exception. Cannot evaluate com.epo.blog.pojo.Blog.toString():
从永远到永远-博客开发项目踩坑实录

参考此处!
我猜测导致上边原因可能与hibernate @One ToMany 等类的注解有关!