Hi!

I have configured Spring Email to send emails to users.

I want to use Velocity (not a requirement though, the only requirement is to
have templating) to help me generate the body of the mail.

I have a Tapestry service where I inject both VelocityEngine and MailSender
services.

Then, in the method sendRegistrationConfirmationEmail(User user)  {

...

String body =
VelocityEngineUtils.mergeTemplateIntoString(this.velocityEngine,
"UserRegistrationConfirm.vm", model);

}

I have my template UserRegistrationConfirm.vm in
src/main/resources/ under the same package as my service from where I use
velocity.

However the template could not be found.

I have in my applicationContext.xml the following configuration for
Velocity:



    <bean id="velocityEngine"
class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
        <property name="velocityProperties">
            <props>
                <prop key="resource.loader">class</prop>
                <prop key="class.resource.loader.class">

org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader</prop>
            </props>
    </property>
</bean>

Do you  have any hint on how to tell velocity to lookup in
src/main/resources/... ?

thank you,

Reply via email to