DEV Community

David Marko
David Marko

Posted on

Vaadin 23: Integration with SpringBoot can boost your development speed

Vaadin is a Java framework for building web applications. It allows developers to build web applications using Java code instead of JavaScript, HTML, and CSS. Vaadin provides a set of pre-built UI components and tools for creating responsive and interactive user interfaces. It also includes a server-side architecture for handling browser-server communication and an API for building client-side logic. Vaadin is open-source and can be used with any Java application server or servlet container.

You might be interested in Vaadin, if you are existing SpringBoot developer.

Vaadin and Spring Boot are both Java frameworks, but they are used for different purposes.

Vaadin is a framework for building web applications, specifically for creating user interfaces. It provides a set of pre-built UI components and tools for creating responsive and interactive user interfaces. It also includes a server-side architecture for handling browser-server communication and an API for building client-side logic.

Spring Boot, on the other hand, is a framework for building web applications based on the Spring framework. It provides a set of tools for setting up and configuring a Spring application, including an embedded web server, database connection, and security. Spring Boot also makes it easy to build and run stand-alone, production-grade Spring-based applications.

In summary, Vaadin is a Java web framework that focuses on building UI and client-side logic, while Spring Boot is a Java framework that focuses on building server-side applications using the Spring framework.

Vaadin 23: Integration with SpringBoot can boost your development speed

You could use Vaadin to build the front-end and use Spring Boot for the back-end of your web application. They are not mutually exclusive, Vaadin application can run on Spring Boot and Spring Boot can be used to expose vaadin as a web application.

Sure! Here is an example of a simple Vaadin application that displays a button and a label. When the button is clicked, the label text is updated to say “Button was clicked!”.

import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.html.Label;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.server.PWA;

@Route
@PWA(name = "My Vaadin Application", shortName = "Vaadin App")
public class MainView extends VerticalLayout {
    public MainView() {
        Label label = new Label("Button has not been clicked yet.");
        Button button = new Button("Click me", e -> label.setText("Button was clicked!"));        add(button, label);
    }
}
Enter fullscreen mode Exit fullscreen mode

This example uses a VerticalLayout to arrange the button and label vertically on the page. The @route annotation tells Vaadin to use this class as the root view of the application. The @PWA annotation tells Vaadin to create a Progressive Web App.

The button is created with a click listener, which updates the text of the label when the button is clicked.

You can run this application with a servlet container such as Apache Tomcat or Jetty, or with a framework like Spring Boot.

Please note that this is a very basic example and in real world applications, you should use some kind of dependency injection and a separation of concerns in the code.

Interested in more details?
You are welcome to take part in Udemy Course …
FullStack Vaadin (14–23+) — Practical Solutions — Vaadin 14–23+ — working with MongoDB, PDF, MS Excel, Vaadin Push, GridFS

Latest comments (0)