public class SpringTemplateLoader extends 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,
String templateLoaderPath)
Create a new SpringTemplateLoader.
|
Modifier and Type | Method and Description |
---|---|
void |
closeTemplateSource(Object templateSource) |
Object |
findTemplateSource(String name) |
long |
getLastModified(Object templateSource) |
Reader |
getReader(Object templateSource,
String encoding) |
protected final Log logger
public SpringTemplateLoader(ResourceLoader resourceLoader, String templateLoaderPath)
resourceLoader
- the Spring ResourceLoader to usetemplateLoaderPath
- the template loader path to use@Nullable public Object findTemplateSource(String name) throws IOException
findTemplateSource
in interface freemarker.cache.TemplateLoader
IOException
public Reader getReader(Object templateSource, String encoding) throws IOException
getReader
in interface freemarker.cache.TemplateLoader
IOException
public long getLastModified(Object templateSource)
getLastModified
in interface freemarker.cache.TemplateLoader
public void closeTemplateSource(Object templateSource) throws IOException
closeTemplateSource
in interface freemarker.cache.TemplateLoader
IOException