This bean must be included in the application context of any application
using FreeMarkerView. It exists purely to configure FreeMarker.
It is not meant to be referenced by application components but just internally
by FreeMarkerView. Implements FreeMarkerConfig to be found by
FreeMarkerView without depending on the bean name of the configurer.
Note that you can also refer to a pre-configured FreeMarker Configuration instance via the "configuration" property. This allows to share a FreeMarker Configuration for web and email usage for example.
This configurer registers a template loader for this package, allowing to reference the "spring.ftl" macro library contained in this package:
<#import "/spring.ftl" as spring/>
<@spring.bind "person.age"/>
age is ${spring.status.value}
Note
Spring's FreeMarker support requires FreeMarker 2.3 or higher.
| Modifier and Type | Field and Description |
|---|---|
| private freemarker. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterPropertiesSet()
Implements org. Initialize FreeMarkerConfigurationFactory's Configuration if not overridden by a pre-configured FreeMarker Configuration. |
| public freemarker. | getConfiguration()
Implements org. Return the Configuration object wrapped by this bean. |
| protected void | postProcessTemplateLoaders(List<freemarker.
the current List of TemplateLoader instances,
to be modified by a subclass templateLoadersOverrides org. This implementation registers an additional ClassTemplateLoader for the Spring-provided macros, added to the end of the list. |
| public void | setConfiguration(freemarker.
Set a pre-configured Configuration to use for the FreeMarker web config, e.g. a shared one for web and email usage. |
| configuration | back to summary |
|---|---|
| private freemarker. | |
| FreeMarkerConfigurer | back to summary |
|---|---|
| public FreeMarkerConfigurer() | |
| afterPropertiesSet | back to summary |
|---|---|
| public void afterPropertiesSet() throws IOException, freemarker.template.TemplateException Implements org. Initialize FreeMarkerConfigurationFactory's Configuration if not overridden by a pre-configured FreeMarker Configuration. Sets up a ClassTemplateLoader to use for loading Spring macros.
| |
| getConfiguration | back to summary |
|---|---|
| public freemarker. Implements org. Return the Configuration object wrapped by this bean.
| |
| postProcessTemplateLoaders | back to summary |
|---|---|
| protected void postProcessTemplateLoaders(List<freemarker. Overrides org. This implementation registers an additional ClassTemplateLoader for the Spring-provided macros, added to the end of the list.
| |
| setConfiguration | back to summary |
|---|---|
| public void setConfiguration(freemarker. Set a pre-configured Configuration to use for the FreeMarker web config, e.g. a shared one for web and email usage. If this is not set, FreeMarkerConfigurationFactory's properties (inherited by this class) have to be specified. | |