mirror of https://github.com/jeecgboot/jeecg-boot
Use classpath loader for FreeMarker template
parent
e7857333e3
commit
9d2697affa
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.business.service.impl;
|
package org.jeecg.modules.business.service.impl;
|
||||||
|
|
||||||
|
import freemarker.cache.ClassTemplateLoader;
|
||||||
import freemarker.cache.FileTemplateLoader;
|
import freemarker.cache.FileTemplateLoader;
|
||||||
import freemarker.cache.TemplateLoader;
|
import freemarker.cache.TemplateLoader;
|
||||||
import freemarker.template.Configuration;
|
import freemarker.template.Configuration;
|
||||||
|
@ -66,11 +67,9 @@ public class EmailServiceImpl implements EmailService {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public FreeMarkerConfigurer freemarkerClassLoaderConfig() throws IOException {
|
public FreeMarkerConfigurer freemarkerClassLoaderConfig() {
|
||||||
Configuration configuration = new Configuration(Configuration.VERSION_2_3_31);
|
Configuration configuration = new Configuration(Configuration.VERSION_2_3_31);
|
||||||
TemplateLoader templateLoader = new FileTemplateLoader(new File(env.getProperty("jeecg.path.emailTemplateDir"))) {
|
configuration.setTemplateLoader(new ClassTemplateLoader(getClass(), "/templates"));
|
||||||
};
|
|
||||||
configuration.setTemplateLoader(templateLoader);
|
|
||||||
FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
|
FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
|
||||||
freeMarkerConfigurer.setConfiguration(configuration);
|
freeMarkerConfigurer.setConfiguration(configuration);
|
||||||
return freeMarkerConfigurer;
|
return freeMarkerConfigurer;
|
||||||
|
|
Loading…
Reference in New Issue