我已经实现了spring boot应用程序,我们需要使用freemarker发送电子邮件。应用程序将部署在google应用程序引擎上,其中文件结构不可用于存储模板。因此,我将模板保存在具有公共访问权限的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加载模板。我如何加载这个?
https://stackoverflow.com/questions/56580519
复制相似问题