下面列出了怎么用org.springframework.boot.autoconfigure.freemarker.FreeMarkerProperties的API类实例代码及写法,或者点击链接到github查看源代码。
@PostConstruct
private void init() {
configuration = ContextUtil.bean(Configuration.class);
FreeMarkerProperties properties = ContextUtil.bean(FreeMarkerProperties.class);
loaderPath = properties.getTemplateLoaderPath()[0];
suffix = properties.getSuffix();
for (RenderMode mode : RenderMode.values()) {
reverterMap.put(mode, ReflectUtil.instance(mode.getReverter()));
}
Assert.notNull(configuration, "configuration must not be null");
Assert.notNull(loaderPath, "loaderPath must not be null");
Assert.notNull(suffix, "suffix must not be null");
}
@Bean
@ConditionalOnMissingBean(FreemarkerConfigurer.class)
public FreemarkerConfigurer freemarkerConfigurer(@Qualifier("email") freemarker.template.Configuration emailFreemarkerConfiguration,
@Qualifier("sms") freemarker.template.Configuration smsFreemarkerConfiguration,
@Autowired(required=false) OghamCommonTemplateProperties templateProperties,
@Autowired(required=false) OghamEmailProperties emailProperties,
@Autowired(required=false) OghamSmsProperties smsProperties,
@Autowired(required=false) FreeMarkerProperties freemarkerProperties,
@Autowired(required=false) OghamFreemarkerProperties oghamFreemarkerProperties,
@Autowired ApplicationContext applicationContext) {
return new FreemarkerConfigurer(emailFreemarkerConfiguration, smsFreemarkerConfiguration, templateProperties, emailProperties, smsProperties, freemarkerProperties, oghamFreemarkerProperties, applicationContext);
}
public FreemarkerConfigurer(Configuration emailConfiguration, Configuration smsConfiguration, OghamCommonTemplateProperties templateProperties, OghamEmailProperties emailProperties,
OghamSmsProperties smsProperties, FreeMarkerProperties springProperties, OghamFreemarkerProperties oghamFreemarkerProperties, ApplicationContext applicationContext) {
super();
this.emailConfiguration = emailConfiguration;
this.smsConfiguration = smsConfiguration;
this.templateProperties = templateProperties;
this.emailProperties = emailProperties;
this.smsProperties = smsProperties;
this.springProperties = springProperties;
this.oghamFreemarkerProperties = oghamFreemarkerProperties;
this.applicationContext = applicationContext;
}