我将java应用程序打包到myApplication.jar中,其结构如下:
问题是如何将模板位置dir传递给配置的?我尝试过使用Spring =newresource.getFile()(“/ClassPathResource/”);但在ClassPathResource时会抛出异常
我的配置初始化代码:
cfg = new Configuration();
cfg.setCacheStorage(new freemarker.cache.MruCacheStorage(20, 250));
cfg.setDirectoryForTemplateLoading(dir);
cfg.setObjectWrapper(new DefaultObjectWrapper());发布于 2013-02-04 22:14:21
我找到答案了here
cfg.setClassForTemplateLoading(getClass(), "/templates");https://stackoverflow.com/questions/14696475
复制相似问题