Class FreeMarkerConfigurer

java.lang.Object
org.springframework.ui.freemarker.FreeMarkerConfigurationFactory
org.springframework.web.reactive.result.view.freemarker.FreeMarkerConfigurer
All Implemented Interfaces:
Aware, InitializingBean, ResourceLoaderAware, FreeMarkerConfig

public class FreeMarkerConfigurer extends FreeMarkerConfigurationFactory implements FreeMarkerConfig, InitializingBean, ResourceLoaderAware
Configures FreeMarker for web usage via the "configLocation" and/or "freemarkerSettings" and/or "templateLoaderPath" properties. The simplest way to use this class is to specify just a "templateLoaderPath" (e.g. "classpath:templates"); you do not need any further configuration then.

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.
Since:
5.0
Author:
Rossen Stoyanchev