Table of contents
1.
Introduction
2.
Vaadin
2.1.
Working of Vaadin
3.
Adding Dependencies
4.
Running Spring Boot Applications
5.
Adding Vaadin View to a Spring Boot Application
6.
Frequently Asked Questions
6.1.
Who is Vaadin for?
6.2.
When ought one to employ Vaadin Flow?
6.3.
Can Vaadin be used to create PWAs?
7.
Conclusion
Last Updated: Aug 13, 2025
Medium

Using Vaadin With Spring Boot

Author Shivani Singh
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

A preconfigured version of the Spring framework called Spring Boot makes it simple to develop standalone, enterprise-level apps. A backend framework called Spring Boot has gained significant traction in the Java enterprise sector. It enables Java developers to easily and quickly begin creating web apps. You do not need to deploy or install a web server because Spring Boot includes one embedded. You run a Vaadin application as a Java application as opposed to deploying it to a servlet container.

With so many front-end framework options available today that perform nicely with a Java Spring Boot backend, we are spoiled for choice.

If you are eager to learn advanced front-end web development, Enroll in our Spring Boot Course to boost your skills

Spring boot intro image

When used in accordance with the assumptions stated by the original framework designer, an opinionated framework's users will have the least amount of friction with it.

Vaadin is an open-source framework for developing websites that allows you to utilize Java and HTML to create user interfaces. A server-side API is Vaadin. Starting with Vaadin 10 (Flow Project) and continuing through Vaadin 14, GWT was replaced with Web Component Polymer. Let us see about this in detail. 

Vaadin

As we said earlier, Java programmers can create fantastic user experiences with Vaadin, an open-source web framework. Vaadin offers you a collection of carefully chosen tools and libraries that work well together and are written in plain TypeScript or Java. Because of this, learning Vaadin- or library-specific information is not necessary much of the time.

vaadin with spring boot intro image

With Vaadin, you get a backend framework, server-client communication, tooling, and components in addition to a frontend framework with all of its features. Vaadin is ideally suited to larger projects with longer lifespans because of its maintainability, comprehensive type safety, and technique for guaranteeing that your backend and frontend stay in sync.

You have instant access to everything. Vaadin eliminates the requirement for setup and configuration time for developers. Instead, you can immediately begin programming to improve productivity.

A developer can incorporate Java UI elements like buttons, text fields, and other web components into the layout using Vaadin Flow. Features of Vaadin Flow include:

  • an architecture that allows you to focus on the user interface There is no need to consider client-server communication.
  • a group of stunning UI elements that emphasize both the developer and end-user experiences.
  • Strong abstraction layers allow you to create your own reusable UI elements using Java or HTML templates.
  • Java's type-safe Data Binding API is used to link UI elements to any backend.
  • For user navigation, a router API creates hierarchical page structures.

Working of Vaadin

A component-based UI building framework for Java is called Vaadin. It can be constructed by making components and arranging them in configurations.

The class MainView extends Each component that is introduced to the layout component with vertical compositions is referred to as a VerticalLayout. Components include things like a button, text field, combo box, and more.

Adding Dependencies

Vaadin offers a startup dependency that includes all the necessary modules and auto-configuration, similar to many other tech stacks on Spring Boot. Only the vaadin-spring-boot-starter dependence is necessary, however, if you require further Vaadin dependencies, we advise you to also declare the vaadin-bom dependency. We also advise adding the vaadin-maven-plugin, which creates the optimized JavaScript packages, for production builds.

Examples of pom.xml dependencies for Vaadin Spring Boot.

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-bom</artifactId>
            <!-- declare the latest Vaadin version
                 as a property or directly here -->
            <version>${vaadin.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>
            vaadin-spring-boot-starter
        </artifactId>
        <version>${vaadin.version}</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <!-- The Spring Boot Maven plugin for easy
             execution from CLI and packaging -->
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>
                spring-boot-maven-plugin
            </artifactId>
        </plugin>
        <!--
            Takes care of synchronizing java
            dependencies and imports in package.json and
            main.js files. It also creates
            webpack.config.js if does not exist yet.
        -->
        <plugin>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-maven-plugin</artifactId>
            <version>${vaadin.version}</version>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-frontend</goal>
                        <goal>build-frontend</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Running Spring Boot Applications

Applications created using Spring Boot are run using the standard main() function. Spring Boot launches a web server and sets up Vaadin with Spring if a Vaadin Spring dependency is on your classpath. If you used https://start.vaadin.com or https://start.spring.io to build your project, you already have access to an application class with the main() method.

Application class, for instance.

Under the hood, Spring Boot is enabled by the @SpringBootApplication annotation. The auto-configuration, component scanning, and Spring configuration are all included in this.

Adding Vaadin View to a Spring Boot Application

Vaadin uses the @Route annotation to define views as Java classes. The classes are identified and published during application startup at a path obtained from the class name or specified as a parameter to the annotation. Consider the MainView class.

@Route
public class MainView extends VerticalLayout {
   public MainView() {
   add(new Text("Welcome to MainView."));
   }
}

If you don't give the framework a path parameter, it will infer the path from the class name. Any trailing "View" will be dropped, and the derived name will be written in lowercase. Additionally, MainView and Main will map to root (that is, the path will be "").

Frequently Asked Questions

Who is Vaadin for?

Vaadin is made to increase full-stack teams' productivity. You may concentrate all your efforts on creating functionality thanks to full-stack type safety and smooth server-to-browser communication.

When ought one to employ Vaadin Flow?

The productivity and security of the Flow framework are its main focuses.

Using Flow, the entire application may be created in Java. There is no need to create REST endpoints or other communication-layer code because server-client communication is automated. Because of the server-side architecture, Flow is by design very secure.

Can Vaadin be used to create PWAs?

Yes. Applications created using Vaadin are by default progressive web apps. For an offline fallback page, the starters create a manifest file and a service worker. The offline page, icons, and colors can all be changed.

Conclusion

In this blog, we discussed the basics of Spring Boot and why is it used. We also discussed the Vaadin framework of Spring Boot, it's working. Then we saw various operations which can be performed like adding dependencies, running Spring Boot applications, and lastly adding Vaadin view to Spring Boot application.

Do upvote our blogs if you find them helpful and engaging!

Happy Learning!

thank you image

 

Live masterclass