Basics

First of all, be sure you have read the Getting Started chapter.

A configuration is a freemarker.template.Configuration object that stores your common (global, application level) settings and defines variables that you want to be available in all templates (so called shared variables). Also, it deals with the creation and caching of Template instances.

An application typically uses only a single shared Configuration instance. More precisely, typically you have one Configuration instance per independently developed component that internally uses FreeMarker, so they can be configured independently of each other. For example, your e-mail sender component and your report generator component (service) probably want to use their own Configuration-s, as their needs differ.

As the behavior of templates depends on the configuration settings, each Template instance has an associated Configuration instance. If you obtain the Template instances with Configuration.getTemplate, the associated Configuration instance will be the one whose getTemplate method was called. If you create the Template instances directly with the Template constructor, the Configuration should be specified as constructor parameter.