java - Freemarker 表达未定义
问题描述
我在模板中有以下freemarker:
${root.product.getInventoryReference(channel)}
在eclipse中运行我的应用程序时它工作正常但是当我运行编译版本时我得到错误:
Expression root.product.getInventoryReference(channel) is undefined on line 3, column 28 in rtd.integration.builder.ApiOperationConfigurationKeySource@b701440-sourceTemplate.
The problematic instruction:
----------
==> ${root.product.getInventoryReference(channel)} [on line 3, column 26 in rtd.integration.builder.ApiOperationConfigurationKeySource@b701440-sourceTemplate]
----------
我的产品对象具有如下 getInventoryReference 方法:
public class Product extends ... {
...
public String getInventoryReference(Channel channel) {
ChannelProduct selectedChannelProduct = getChannelProduct(channel);
if (selectedChannelProduct != null) {
return selectedChannelProduct.getInventoryReference();
}
return null;
}
...
}
我知道 product、root 和 channel 不为空,因为我能够从同一模板中的 root.product 访问其他方法,并在其他地方使用 channel。
我还检查了我的应用程序的构建版本中的产品类文件实际上确实具有该方法。反编译后我可以确认是这种情况。
有没有人对为什么这可能会失败有任何其他想法?谢谢
解决方案
推荐阅读
- python - Numba 矩阵乘法比 NumPy 慢得多
- c# - C#如何将绑定文本与正则表达式匹配?
- scala - VS Code 中的 Scala 和集成终端
- python - 通过 Flask 上传多个文件或整个文件夹
- css - 在 Angular 中处理 CSS
- php - Docker-compose 构建内存不足
- sql - SQL Server - 按外观替换字符串
- kubernetes - Kubernetes 部署失败,在 GKE 中出现“Failed create pod sandbox”
- spring - 如何在 Spring Boot 应用程序中为带有 @Configuration 注释的类编写单元测试用例
- php - 读取目录不在文件系统顺序中