【发布时间】:2019-10-28 01:10:55
【问题描述】:
我已经实现了 spring boot 应用程序,我们需要使用 freemarker 发送电子邮件。 应用程序将部署在谷歌应用程序引擎上,其中文件结构无法存储模板。因此,我将模板保存在可公开访问的 Google 存储中。但无法在 freemarker 模板引擎中加载。
freeMarkerConfiguration.setDirectoryForTemplateLoading(new File("/home/dnilesh/Downloads/helloworld-springboot/src/main/resources/"));
content.append(FreeMarkerTemplateUtils.processTemplateIntoString(
freeMarkerConfiguration.getTemplate("Email.html"),model));
以上配置适用于开发环境。但是在谷歌应用引擎上我没有目录来存储模板。
我试过这个:
freeMarkerConfiguration.setDirectoryForTemplateLoading(new File("https://storage.googleapis.com/nixon-medical/"));
content.append(FreeMarkerTemplateUtils.processTemplateIntoString(
freeMarkerConfiguration.getTemplate("Email.html"),model));
但是 freemarker 没有从外部 URL 加载模板。这个怎么加载?
【问题讨论】:
标签: google-app-engine google-cloud-storage freemarker template-engine