1@Bean
2 @Primary
3 public FreeMarkerConfigurationFactoryBean getFreeMarkerConfiguration() throws IOException {
4 FreeMarkerConfigurationFactoryBean bean = new FreeMarkerConfigurationFactoryBean();
5 ClassTemplateLoader ctl = new ClassTemplateLoader(getClass(), "/templates");
6 bean.setPostTemplateLoaders(ctl);
7 return bean;
8 }
1@Bean
2public FreeMarkerConfigurer freemarkerClassLoaderConfig() {
3 Configuration configuration = new Configuration(Configuration.VERSION_2_3_27);
4 TemplateLoader templateLoader = new ClassTemplateLoader(this.getClass(), "/mail-templates");
5 configuration.setTemplateLoader(templateLoader);
6 FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
7 freeMarkerConfigurer.setConfiguration(configuration);
8 return freeMarkerConfigurer;
9}