我正在尝试将 Velocity 配置为从文件系统读取模板文件,而不是从类路径读取模板文件。如果我将velocityEngine配置为:
<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean"
p:resourceLoaderPath="classpath:/com/myapp/test"
p:preferFileSystemAccess="false"/>
并将 templatefile.vm 放入 com.myapp.test 包中。
如何更改上述内容,以便我可以将模板文件放在文件系统中的任何位置并访问它。我试过了,但没有用。
<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean"
p:resourceLoaderPath="c:\home\users\me\app\templates"
p:preferFileSystemAccess="true"/>
我试图用谷歌搜索是否能找到解决方案,但大多数示例都是针对 Spring MVC 配置的。我正在使用独立的 Spring 应用程序。
谢谢