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

前言

本文中提到的解決方案,源碼地址在:springboot-thymeleaf,但願能夠幫你解決問題。html

本文中涉及的兩個異常爲我開發時遇到的,可能和你目前所要處理的bug不一樣,若是不是同一個問題,但願再找找其餘文章。git

異常

Exception evaluating SpringEL expression這個異常的出現應該有不少緣由引發,本文中涉及的兩個異常分別爲:github

  • 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 objectspring

  • 異常2 :
Method cannot be found

方法不存在

解決方案能夠參考個人這篇文章:Method service() cannot be found on com.my.blog.springboot.thymeleaf.util.MethodTest typeexpress

相關文章
相關標籤/搜索