Spring 里面使用velocity作文邮件模板,但是发送时提示找不到文件资源。原因:要对创建的velocityengine 进行设置。
方法如下:
velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER,"classpath" );
velocityEngine.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
velocityEngine.init();
在资源路径里面设置:
templates/xxxxx.vm