public class SpringTemplateLoader
extends java.lang.Object
implements freemarker.cache.TemplateLoader
TemplateLoader
adapter that loads via a Spring ResourceLoader
.
Used by FreeMarkerConfigurationFactory
for any resource loader path that cannot
be resolved to a File
.FreeMarkerConfigurationFactory.setTemplateLoaderPath(java.lang.String)
,
Configuration.setDirectoryForTemplateLoading(java.io.File)
Constructor and Description |
---|
SpringTemplateLoader(ResourceLoader resourceLoader,
java.lang.String templateLoaderPath)
Create a new SpringTemplateLoader.
|
Modifier and Type | Method and Description |
---|---|
void |
closeTemplateSource(java.lang.Object templateSource) |
java.lang.Object |
findTemplateSource(java.lang.String name) |
long |
getLastModified(java.lang.Object templateSource) |
java.io.Reader |
getReader(java.lang.Object templateSource,
java.lang.String encoding) |
protected final Log logger
public SpringTemplateLoader(ResourceLoader resourceLoader, java.lang.String templateLoaderPath)
resourceLoader
- the Spring ResourceLoader to usetemplateLoaderPath
- the template loader path to use@Nullable public java.lang.Object findTemplateSource(java.lang.String name) throws java.io.IOException
findTemplateSource
in interface freemarker.cache.TemplateLoader
java.io.IOException
public java.io.Reader getReader(java.lang.Object templateSource, java.lang.String encoding) throws java.io.IOException
getReader
in interface freemarker.cache.TemplateLoader
java.io.IOException
public long getLastModified(java.lang.Object templateSource)
getLastModified
in interface freemarker.cache.TemplateLoader
public void closeTemplateSource(java.lang.Object templateSource) throws java.io.IOException
closeTemplateSource
in interface freemarker.cache.TemplateLoader
java.io.IOException