Spring Freemarker 相关问题

imxjs2011a imxjs2011a 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

private Configuration conf;

public void setFreeMarkerConfigurer(
FreeMarkerConfigurer freeMarkerConfigurer) {
//spring的FreeMarkerConfigurer
this.conf = freeMarkerConfigurer.getConfiguration();
}

@Transactional(readOnly = true)
public void index(CmsSite site, String tpl, Map<String, Object> data)
throws IOException, TemplateException {
long time = System.currentTimeMillis();
File f = new File(getIndexPath(site));
File parent = f.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
Writer out = null;
try {
out = new OutputStreamWriter(new FileOutputStream(f), UTF8);
Template template = conf.getTemplate(tpl);
template.process(data, out);
} finally {
if (out != null) {
out.flush();
out.close();
}
}
time = System.currentTimeMillis() - time;
log.info("create index page, in {} ms", time);
}


我想知道在哪注入freemarker实例了。类文件里没有。 配置文件中也没有找到。
请知道的朋友告诉一下这个是怎么配置的,谢谢。 如果有相关的资料就更好了。 感谢!
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
imxjs2011a
Java EE 67,535 成员 225,843 内容