Caused by: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing

本方法仅适用于 freemarker&springboot
IDEA控制台这样:Tip: If the failing expression is known to be legally refer to something that’s sometimes null or missing, either specify a default value like myOptionalVar!
错误又是:Caused by: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing
原因:有变量是空值但是却${}了出来导致的
解决方法:在改变量后面补一个感叹号和一个字符串。
如果为空,就以默认值(“!”后的字符)显示。
举例:如果变量为:user,那么可以更改为${user!""}

上一篇:Codeforces Round #744 (Div. 3)


下一篇:连接redis时遇到Caused by: io.netty.channel.ConnectTimeoutException: connection timed out: /问题