Docs

Documentation versions (currently viewingVaadin 24)

Vaadin & Spring Boot

The role Spring Boot plays in Vaadin applications.

The recommended way of building Vaadin applications is with Spring Boot. Thus, a Vaadin application is a Spring Boot application with a Vaadin user interface. Everything you can do in a Spring Boot application, you can also do in a Vaadin application.

Spring Framework

Spring Framework is a Java framework that was created around 2003 as a response to the then overly complicated J2EE platform. Spring offered a simpler, more straightforward way of building enterprise applications in Java. One of the most important concepts that Spring introduced was Inversion of Control (IoC).

In a typical computer program, the program controls its own flow by creating objects and calling methods. IoC is a principle in which the control flow is given to an external source (e.g., a framework). The framework would then be responsible for creating and destroying the objects and calling methods, according to some specification.

Spring introduced the concept of a bean container. Beans were Java objects instantiated and managed by Spring. If bean main depended on bean auxiliary, Spring would make sure that bean auxiliary was initialized before bean main. Spring would also inject the instance of bean auxiliary into bean main, removing the need for bean main to look up its own dependencies. This pattern is called dependency injection.

The developer would write the classes and create a bean configuration which instructed Spring how to construct the beans. This configuration was written originally in XML. Lately, it’s created using a combination of Java annotations, Java code, and conventions.

Spring Framework also introduced many other features. It’s grown to be its own platform. However, the concepts of dependency injection and bean configurations are key to understanding the Vaadin Way of structuring applications.

For more information about Spring Framework, see the Spring Framework Documentation.

Spring Boot

As the Spring platform grew, it became more complicated to build Spring applications. At the same time, the software industry was starting to adopt microservices and deploying them in containerized environments. Developers wanted easier ways to build lightweight web applications that could run as standalone services, as opposed to being deployed to a dedicated application server.

Spring Boot was created in response to these demands. It considered how to best create Spring applications, provided sensible defaults, starter dependencies, and production-ready features for application configuration and observability. It introduced embedded servlet containers, making it possible to package an application as a self-contained, executable JAR file.

In practice, this reduced the base code and configuration complexity of traditional Spring applications to a minimum. Developers could now create full-scale, production-ready Java web applications with only a few lines of custom code.

For more information about Spring Boot, see the Spring Boot Documentation.

Vaadin with Spring

Vaadin has been around as long as Spring. Although it has always been possible to use Spring and Vaadin together, it wasn’t until the introduction of Spring Boot that official Spring support was added to Vaadin. Over the years, the Spring support has been expanded to such a degree that it’s now the recommended way of building Vaadin applications.

A Vaadin application consists of two conceptual layers: the presentation layer; and the application layer. The presentation layer is the user interface, and the application layer is everything else (i.e., the domain model, services, persistence, etc.).

The presentation layer is built using Vaadin, which allows you to use either Java, React, or both — depending on your needs and skills. The application layer is built using Spring Boot and everything it has to offer, which is plenty.

The combined versatility of Vaadin and Spring Boot means you have an extensive toolbox at your disposal. However, this can be confusing or overwhelming. Spring Boot provided an opinionated view of the Spring platform to make it easier to use. The Vaadin Way provides an opinionated view of building business applications with Vaadin and Spring Boot to make it easier for you.