2013-08-02 37 views
2

在Velocity模板語言腳本的InputStream,我可以使用#include指令從本地文件讀取速度宏和腳本元素。包括在速度

我想我的速度腳本庫存儲在數據庫中,而不是。

我可以從一個Java InputStream#include,無論是從VTL腳本還是從Java應用程序調用org.apache.velocity.app.Velocity#evaluate

+0

?我正在處理大文件,我試圖掌握速度模板的內存佔用情況... – cringe

回答

0

由於Velocity 1.5,DataSourceResourceLoader允許從在Velocity properties中配置的JDBC數據源加載模板。

配置的屬性文件可以是簡單的:在這個任何更新

resource.loader=class, ds 
class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader 

ds.resource.loader.class=org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader 
ds.resource.loader.resource.datasource=... 
ds.resource.loader.resource.table=... 
ds.resource.loader.resource.keycolumn=... 
ds.resource.loader.resource.templatecolumn=... 
ds.resource.loader.resource.timestampcolumn=...