Accessing a database with Spring
We will make a simple application that adds new orders to the database. A user just fills in a name of the order and clicks on the Add New Order button.
The orders will be stored in the in-memory database and it will be easy to switch the database, for example to MySQL. For accessing the database, we use JdbcTempate
from Spring framework.

Getting ready
Create a new Maven project from the Vaadin archetype.
mvn archetype:generate \ -DarchetypeGroupId=com.vaadin \ -DarchetypeArtifactId=vaadin-archetype-application \ -DarchetypeVersion=LATEST \ -Dpackaging=war \ -DgroupId=com.app \ -DartifactId=vaadin-spring-database \ -Dversion=1.0
The project structure will be as follows:

How to do it...
Carry out the following steps, in order to create a Vaadin application with access to the database with Spring framework:
Add the necessary dependencies to the Maven
pom.xml
file.<dependency> <groupId>org.springframework</groupId> <artifactId>spring...