Velocity is the templating language provided by Apache. It can be integrated into the Spring view layer easily. The latest Velocity version used during this book is 1.7. In the previous section, we demonstrated using Velocity to send e-mails using the @Bean
and @Configuration
annotations. In this section, we shall see how we can configure Velocity to send mails using XML configuration.
All that needs to be done is to add the following bean definition to the .xml
file. In the case of mvc
, you can add it to the dispatcher-servlet.xml
file.
<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean"> <property name="velocityProperties"> <value> resource.loader=class class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader </value> </property> </bean>
Create a new Maven web project with the name
Spring4MongoDB_Mail_VelocityChapter3...