unable to find resource 'emailTemplate.vm' in any resource loader

Spring 裏面使用velocity作文郵件模板,但是發送時提示找不到文件資源。原因:要對創建的velocityengine  進行設置。

方法如下:

velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER,"classpath" ); 
                               
      velocityEngine.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
velocityEngine.init();

在資源路徑裏面設置:

templates/xxxxx.vm

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章