org.apache.velocity.exception.ResourceNotFoundException:无法找到资源'verificationEmail.vm'

时间:2017-03-08 19:01:22

标签: spring-mvc velocity

我已经看到了关于这个问题的解决方案,但我没有找到任何解决方案。 我的mailsender.xml是

<bean id="velocityEngine"
    class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
    <property name="resourceLoaderPath" value="/email_Templates" />
    <property name="preferFileSystemAccess" value="false" />
</bean>

我的速度实现代码是..

public void sendUserActivationMail(User user, String requestUrl) throws Exception {
    String plainText = System.currentTimeMillis() + "##" + user.getUserId();
    userDao.insertRegistraionToken(user.getUserId(), plainText, "123456");

    String token = AESEncrypter.encrypt(plainText);
    String url = requestUrl + "/activateUser.htm?token=" + URLEncoder.encode(token, "UTF-8");
    try {
        Map<String, Object> storemap = new HashMap<String, Object>();
        storemap.put("toUserName", user.getName());
        storemap.put("fromUseerName", ApplicationConstants.TEAM_NAME);
        storemap.put("url", url);
        String text = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "verificationEmail.vm", "UTF-8", storemap);

        mailService.sendMail(senderMailId, new String[] { user.getEmail() }, null, "Registration Activation", text);
    } catch (Exception e) {
        logger.println(IMessage.ERROR,new StringBuilder(CLASS_NAME).append("::runProfileIncompleteCron()  exception ==" + e));
    }

}

我的文件夹结构是 -

src/main/resources
    |_email_Templates
       |
       |__verificationEmail.vm

但显示错误

  

org.apache.velocity.exception.ResourceNotFoundException:无法找到资源'verificationEmail.vm'

0 个答案:

没有答案
相关问题