Send email using email template library via Spring

This tutorial will show you how to send a basic mail via Spring framework’s email support using Velocity email template library. We will use class org.springframework.mail.javamail.MimeMessageHelper, which shields you from having to use the verbose JavaMail API. Using the MimeMessageHelper it is pretty easy to create a MimeMessage. The code in the other email sending examples explicitly created the content…

Send email with inline attachment or resource via Spring

This tutorial will show you how to send a basic mail via Spring framework’s email support. We will attach a resource (an image) as an inline attachment in the email body. The Spring Framework provides a helpful utility library class that comes in pretty handy when dealing with JavaMail messages is the org.springframework.mail.javamail.MimeMessageHelper class, which shields you from having to…

Send email with attachment via Spring

This tutorial will show you how to send a basic mail via Spring framework’s email support. A class that comes in pretty handy when dealing with JavaMail messages is the org.springframework.mail.javamail.MimeMessageHelper class, which shields you from having to use the verbose JavaMail API. Using the MimeMessageHelper, it is pretty easy to create a MimeMessage. Multipart email messages allow for both…

Send email via Spring – JavaMailSender and MimeMessageHelper

This tutorial will show you how to send a basic mail via Spring framework’s email support. A class that comes in pretty handy when dealing with JavaMail messages is the org.springframework.mail.javamail.MimeMessageHelper class, which shields you from having to use the verbose JavaMail API. Using the MimeMessageHelper it is pretty easy to create a MimeMessage. You can send simple text email…

Send email via Spring – JavaMailSender and MimeMessagePreparator

This tutorial will show you how to send a email via Spring framework’s email support. The Spring Framework provides a helpful utility library for sending email that shields the user from the specifics of the underlying mailing system and is responsible for low level resource handling on behalf of the client. The org.springframework.mail.javamail.JavaMailSender interface adds specialized JavaMail features such as…

Send email via Spring – MailSender and SimpleMailMessage

Introduction This tutorial will show you how to send a basic mail via Spring framework’s email support. The Spring Framework provides a helpful utility library for sending email that shields the user from the specifics of the underlying mailing system and is responsible for low level resource handling on behalf of the client. The central interface for sending emails is…

BlockingQueue in Java

Blocking Queue A blocking queue is a queue that blocks when you try to dequeue an empty queue, or if you try to enqueue an item in a full queue. Dequeue means when you take an item out of a queue. Enqueue means when you put an item into a queue. A thread trying to dequeue an empty queue is…

Maven setup

This tutorial will show you how to setup Apache Maven in development environment. Prerequisites Maven is a Java tool, so you must have Java installed in order to proceed. Maven 3.3 requires JDK 1.7 or above to execute. So first install Java 1.7 and setup environment path for Java.

Spring @MatrixVariable in a map

In this tutorial I will show you how to obtain matrix variable (using @MatrixVariable annotation) in a map from the URL segment. The URI has the possibility of including name-value pairs within path segments. INnSpring MVC these are referred to as matrix variables. If a URL is expected to contain matrix variables, the request mapping pattern must represent them with…

Spring optional @MatrixVariable with default value

In this tutorial I will show you how we use optional @MatrixVariable with default value in Spring Web MVC. I am going to show you how to set default value to matrix variable to make it optional in the URL segment. The URI has the possibility of including name-value pairs within path segments. Within Spring MVC these are referred to…