spring-framework / org.springframework.ui.freemarker

Package org.springframework.ui.freemarker

Types

FreeMarkerConfigurationFactory

open class FreeMarkerConfigurationFactory

Factory that configures a FreeMarker Configuration. Can be used standalone, but typically you will either use FreeMarkerConfigurationFactoryBean for preparing a Configuration as bean reference, or FreeMarkerConfigurer for web views.

The optional "configLocation" property sets the location of a FreeMarker properties file, within the current application. FreeMarker properties can be overridden via "freemarkerSettings". All of these properties will be set by calling FreeMarker's Configuration.setSettings() method and are subject to constraints set by FreeMarker.

The "freemarkerVariables" property can be used to specify a Map of shared variables that will be applied to the Configuration via the setAllSharedVariables() method. Like setSettings(), these entries are subject to FreeMarker constraints.

The simplest way to use this class is to specify a "templateLoaderPath"; FreeMarker does not need any further configuration then.

Note: Spring's FreeMarker support requires FreeMarker 2.3 or higher.

FreeMarkerConfigurationFactoryBean

open class FreeMarkerConfigurationFactoryBean : FreeMarkerConfigurationFactory, FactoryBean<Configuration>, InitializingBean, ResourceLoaderAware

Factory bean that creates a FreeMarker Configuration and provides it as bean reference. This bean is intended for any kind of usage of FreeMarker in application code, e.g. for generating email content. For web views, FreeMarkerConfigurer is used to set up a FreeMarkerConfigurationFactory. The simplest way to use this class is to specify just a "templateLoaderPath"; you do not need any further configuration then. For example, in a web application context:

 <bean id="freemarkerConfiguration" class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean"> <property name="templateLoaderPath" value="/WEB-INF/freemarker/"/> </bean>
See the base class FreeMarkerConfigurationFactory for configuration details.

Note: Spring's FreeMarker support requires FreeMarker 2.3 or higher.

SpringTemplateLoader

open class SpringTemplateLoader : TemplateLoader

FreeMarker TemplateLoader adapter that loads via a Spring ResourceLoader. Used by FreeMarkerConfigurationFactory for any resource loader path that cannot be resolved to a java.io.File.