Package org.springframework.ui.freemarker

# Class FreeMarkerConfigurationFactoryBean

java.lang.Object
org.springframework.ui.freemarker.FreeMarkerConfigurationFactory
org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean

All Implemented Interfaces:
  `org.springframework.beans.factory.Aware`, `org.springframework.beans.factory.FactoryBean<freemarker.template.Configuration>`, `org.springframework.beans.factory.InitializingBean`, `org.springframework.context.ResourceLoaderAware`

public class FreeMarkerConfigurationFactoryBean extends FreeMarkerConfigurationFactory implements org.springframework.beans.factory.FactoryBean<freemarker.template.Configuration>, org.springframework.beans.factory.InitializingBean, org.springframework.context.ResourceLoaderAware
Factory bean that creates a FreeMarker `Configuration` and provides it as a bean reference.

This bean is intended for any kind of usage of FreeMarker in application code — for example, 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 `FreeMarkerConfigurationFactory` base class for configuration details.

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

Since:
  03.03.2004
Author:
  Darren Davison
See Also:
  - `FreeMarkerConfigurationFactory.setConfigLocation(org.springframework.core.io.Resource)`
  - `FreeMarkerConfigurationFactory.setFreemarkerSettings(java.util.Properties)`
  - `FreeMarkerConfigurationFactory.setTemplateLoaderPath(java.lang.String)`
  - `org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer`

## Field Summary

### Fields inherited from class org.springframework.ui.freemarker.FreeMarkerConfigurationFactory

`logger`

### Fields inherited from interface org.springframework.beans.factory.FactoryBean

`OBJECT_TYPE_ATTRIBUTE`

## Constructor Summary

Constructors
Constructor
Description
`FreeMarkerConfigurationFactoryBean()`

## Method Summary

Modifier and Type
Method
Description
`void`
`afterPropertiesSet()`
`freemarker.template.Configuration`
`getObject()`
`Class<? extends freemarker.template.Configuration>`
`getObjectType()`
`boolean`
`isSingleton()`

### Methods inherited from class org.springframework.ui.freemarker.FreeMarkerConfigurationFactory

`createConfiguration, getAggregateTemplateLoader, getResourceLoader, getTemplateLoaderForPath, isPreferFileSystemAccess, newConfiguration, postProcessConfiguration, postProcessTemplateLoaders, setConfigLocation, setDefaultCharset, setDefaultEncoding, setFreemarkerSettings, setFreemarkerVariables, setPostTemplateLoaders, setPreferFileSystemAccess, setPreTemplateLoaders, setResourceLoader, setTemplateLoaderPath, setTemplateLoaderPaths`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.context.ResourceLoaderAware

`setResourceLoader`

## Constructor Details

### FreeMarkerConfigurationFactoryBean

public FreeMarkerConfigurationFactoryBean()

## Method Details

### afterPropertiesSet

public void afterPropertiesSet() throws IOException, freemarker.template.TemplateException

Specified by:
  `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
Throws:
  `IOException`
  `freemarker.template.TemplateException`

### getObject

@Nullable public freemarker.template.Configuration getObject()

Specified by:
  `getObject` in interface `org.springframework.beans.factory.FactoryBean<freemarker.template.Configuration>`

### getObjectType

public Class<? extends freemarker.template.Configuration> getObjectType()

Specified by:
  `getObjectType` in interface `org.springframework.beans.factory.FactoryBean<freemarker.template.Configuration>`

### isSingleton

public boolean isSingleton()

Specified by:
  `isSingleton` in interface `org.springframework.beans.factory.FactoryBean<freemarker.template.Configuration>`