Docs

Documentation versions (currently viewingVaadin 25.4 (pre-release))

Set Up the Project

Set up a new Vaadin project with the necessary dependencies and configuration.

In this section, you’ll set up the project that you’ll be using throughout this tutorial. When you’re done, you have an empty Vaadin application running on your computer, connected to a database with sample data.

Prerequisites

You need two things installed on your development machine:

  • A Java Development Kit (JDK), version 21 or newer. If you don’t have one, download and install Eclipse Temurin for your operating system.

  • A Java IDE. If you don’t have one, download and install IntelliJ IDEA. The free Community Edition is enough for this tutorial.

Other JDK distributions and IDEs work too. See the Development Environment guide for options.

Tip
Use Hotswap for Faster Development
It is recommended to use hotswap while developing Vaadin applications. Hotswap reloads changed classes in a running JVM without restarting the application, so you see your changes within seconds. The Vaadin plugin for your IDE sets it up for you. See the instructions for IntelliJ IDEA, Visual Studio Code, Eclipse IDE, or NetBeans.

Create the Project

This tutorial starts from an empty project skeleton. Even if you have completed the Quick Start, download a new project here rather than reusing that one, since the view you created there would clash with the views you create in this tutorial.

Click the button below to download a minimal Vaadin project skeleton:

After downloading the project, unzip it and open the project directory in your IDE. In IntelliJ IDEA, select File › Open, pick the unzipped directory, and click Trust Project if asked. For other IDEs, see the import guides for Visual Studio Code, Eclipse IDE, and NetBeans.

Add Dependencies

The application stores its data in an in-memory H2 database. To use the database, you need to add the H2 database and Spring Data JDBC dependencies to your project.

Open the pom.xml file in the root of your project and add the following dependencies inside the <dependencies> section:

Source code
XML
<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jdbc</artifactId>
</dependency>

Then refresh the project in your IDE to download the new dependencies.

Create the Database

Spring Boot creates the database when the application starts, using two SQL files: one for the tables, and one for some sample data. Download the following two files and save them in the src/main/resources directory of your project, next to application.properties:

The schema.sql file contains the database schema, and the data.sql file contains sample data. Spring Boot automatically executes these files every time the application starts, setting up the database for you.

Note
The Data Resets on Restart
Because the database lives in memory, any changes you make in the application disappear when you restart it, and the sample data comes back. This is convenient while you’re learning. The Next Steps page tells you how to switch to a real database.

Run the Application

To make sure everything is set up correctly, run the application. Either start it from your IDE with hotswap enabled, as described in the tip above, or open a terminal in the project directory and run ./mvnw spring-boot:run (mvnw spring-boot:run on Windows).

The first startup may take a while as Maven and npm download the required dependencies.

Check Your Work

Before you continue, verify that your setup matches this list:

  • The <dependencies> section of pom.xml contains the h2 and spring-boot-starter-data-jdbc dependencies.

  • The src/main/resources directory contains schema.sql and data.sql, next to application.properties.

  • The application starts without errors. A log line starting with Started Application near the end of the console output confirms that it’s running.

  • Opening http://localhost:8080 shows a "No views found" page. This is expected: the application has no views yet, and you create the first one in the next step.

If the application fails to start, the console output usually names the cause. A compilation error that mentions org.springframework.data means a dependency is missing from pom.xml. If the SQL files are in the wrong directory, the application still starts, but the view you build in the next step fails with an error about a missing table.

Next Steps

Now that your project is set up, you’re ready to create your first Vaadin view.