I have java application packaged into myApplication.jar having following structure:
Issue is How do i pass templates location dir to configuration? I have tried with Spring Resource resource = new ClassPathResource("/templates/"); but that throws exception when at resource.getFile()
My Configuration initialization code:
cfg = new Configuration();
cfg.setCacheStorage(new freemarker.cache.MruCacheStorage(20, 250));
cfg.setDirectoryForTemplateLoading(dir);
cfg.setObjectWrapper(new DefaultObjectWrapper());
我在这里找到答案
cfg.setClassForTemplateLoading(getClass(), "/templates");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.