【发布时间】:2016-07-19 17:46:57
【问题描述】:
您好,我需要为不同的实体创建 ftl,
我想从嵌套文件夹中加载 ftl,就像所有 A realted ftl 都应该在 A 文件夹中,然后所有的 Macro 都在 Macro 文件夹中。
<bean id="freeMarkerConfigurationFactory" class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean">
<property name="templateLoaderPath" value="classpath:freemarker/Account/"/>
<property name="preferFileSystemAccess" value="false"/>
</bean>
这不起作用。使用 spring 4
<bean id="freeMarkerConfigurationFactory" class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean">
<property name="templateLoaderPath">
<value> "classpath:freemarker/Account/" , "classpath:freemarker/Macro/"</value>
</property>
<property name="preferFileSystemAccess" value="false"/>
</bean>
也是调试完spring类之后
public void setTemplateLoaderPath(String templateLoaderPath) {
this.templateLoaderPaths = new String[] {templateLoaderPath};
}
templateLoaderPath 的行为类似于单个字符串,而不是数组。
【问题讨论】:
标签: spring freemarker