spring-framework / org.springframework.ui.freemarker / FreeMarkerConfigurationFactory / setTemplateLoaderPaths

setTemplateLoaderPaths

open fun setTemplateLoaderPaths(vararg templateLoaderPaths: String): Unit

Set multiple Freemarker template loader paths via Spring resource locations.

When populated via a String, standard URLs like "file:" and "classpath:" pseudo URLs are supported, as understood by ResourceEditor. Allows for relative paths when running in an ApplicationContext.

Will define a path for the default FreeMarker template loader. If a specified resource cannot be resolved to a java.io.File, a generic SpringTemplateLoader will be used, without modification detection.

To enforce the use of SpringTemplateLoader, i.e. to not resolve a path as file system resource in any case, turn off the "preferFileSystemAccess" flag. See the latter's javadoc for details.

If you wish to specify your own list of TemplateLoaders, do not set this property and instead use setTemplateLoaders(List templateLoaders)

See Also
org.springframework.core.io.ResourceEditororg.springframework.context.ApplicationContext#getResourcefreemarker.template.Configuration#setDirectoryForTemplateLoadingSpringTemplateLoader