好吧,好像都是自动接的。不确定当模板名同时出现在这两个位置时会发生什么。为了避免这种情况,我可以添加两个这样的bean:
@Bean
public SpringTemplateEngine emailTemplateEngine() {
final SpringTemplateEngine engine = new SpringTemplateEngine();
final Set<TemplateResolver> templateResolvers = new HashSet<TemplateResolver>();
templateResolvers.add(emailTemplateResolver());
engine.setTemplateResolvers(templateResolvers);
return engine;
}
@Bean
public SpringTemplateEngine pdfTemplateEngine() {
final SpringTemplateEngine engine = new SpringTemplateEngine();
final Set<TemplateResolver> templateResolvers = new HashSet<TemplateResolver>();
templateResolvers.add(pdfTemplateResolver());
engine.setTemplateResolvers(templateResolvers);
return engine;
}