org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression

前言

本文中提到的解决方案,源码地址在:springboot-thymeleaf,希望可以帮你解决问题。

本文中涉及的两个异常为我开发时遇到的,可能和你目前所要处理的bug不同,如果不是同一个问题,希望再找找其他文章。

异常

Exception evaluating SpringEL expression这个异常的出现应该有很多原因引起,本文中涉及的两个异常分别为:

  • org.springframework.expression.spel.SpelEvaluationException: EL1004E: Method call: Method service() cannot be found on com.my.blog.springboot.thymeleaf.util.MethodTest type
  • org.springframework.expression.spel.SpelEvaluationException: EL1011E: Method call: Attempted to call method test() on null context object

解决方案

  • 异常1 :
Attempted to call method on null context object

调用的方法处于一个空对象中,即调用实例为空。

解决方案可以参考我的这篇文章:Method call: Attempted to call method test() on null context object

  • 异常2 :
Method cannot be found

方法不存在

解决方案可以参考我的这篇文章: Method service() cannot be found on com.my.blog.springboot.thymeleaf.util.MethodTest type

推荐一下本人近期维护的开源项目

Spring Boot 开源电商项目(含商城端和后台管理系统)https://github.com/newbee-ltd/newbee-mall

Spring Boot + Vue 前后端分离商城项目https://github.com/newbee-ltd/newbee-mall-vue-app

除注明转载/出处外,皆为作者原创,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利。

posted @   程序员十三  阅读(26699)  评论(1编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
点击右上角即可分享
微信分享提示