Sure! Here's a simple example of a Vaadin application without using Spring Boot. This standalone Vaadin app will run on an embedded server (like Jetty or Tomcat), or be deployed as a WAR file to any servlet container like WildFly, Tomcat, or Payara.
✅ Step-by-Step: Vaadin App Without Spring Boot
🛠️ Tools Used:
- Java 17+
- Maven
- Vaadin 24+ (Vaadin Flow)
- No Spring Boot
1. 📁 Project Structure
my-vaadin-app/
├── src/
│ └── main/
│ ├── java/
│ │ └── com/example/myapp/
│ │ ├── MainView.java
│ │ └── MyApplication.java
│ └── resources/
│ └── META-INF/
│ └── MANIFEST.MF
├── pom.xml
2. 🧾 pom.xml – Maven Configuration
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-vaadin-app</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<vaadin.version>24.3.1</vaadin.version>
<final.name>${project.artifactId}</final.name>
</properties>
<dependencies>
<!-- Vaadin Core -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-core</artifactId>
<version>${vaadin.version}</version>
</dependency>
<!-- Servlet API -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${final.name}</finalName>
<plugins>
<!-- Vaadin plugin for building frontend resources -->
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>build-frontend</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Compiler plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
<!-- WAR plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
3. 📝 MainView.java – Simple UI
package com.example.myapp;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.label.Label;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;
@Route("")
public class MainView extends VerticalLayout {
public MainView() {
Label label = new Label("Hello from Vaadin!");
Button button = new Button("Click me", event -> label.setText("Thanks for clicking!"));
add(label, button);
}
}
4. 🏁 MyApplication.java – Optional Entry Point (for Dev)
This is only needed if you want to run the app with an embedded server during development.
package com.example.myapp;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import com.vaadin.flow.server.VaadinServlet;
public class MyApplication {
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
server.setHandler(context);
ServletHolder servletHolder = new ServletHolder("vaadin", VaadinServlet.class);
servletHolder.setInitParameter("ui", "com.example.myapp.MainView");
context.addServlet(servletHolder, "/*");
server.start();
server.join();
}
}
🔍 You can skip this class and just deploy your WAR to a servlet container like WildFly, Tomcat, or Jetty.
5. 📦 Deploying the App
To build and deploy:
mvn clean package
Then deploy the resulting WAR (target/my-vaadin-app.war) to:
- Apache Tomcat
- WildFly
- GlassFish
- Payara
- Any Jakarta EE compatible container
✅ Result
When you open the browser at http://localhost:8080, you’ll see:
Hello from Vaadin!
[Click me]
After clicking the button, it updates to:
Thanks for clicking!
🚀 Bonus: Run in Embedded Mode (Optional)
If you added the MyApplication.java launcher, you can run directly from the command line:
mvn compile exec:exec@run
Or use your IDE to run the main() method.
🧩 Want More?
You can also add:
- Themes
- Custom components
- Routing
- External CSS/JS
- Data binding
All without needing Spring Boot!
✅ Conclusion
You do not need Spring Boot to use Vaadin. This example shows how to create a simple, standalone Vaadin app using only Maven and standard Java web technologies. It’s perfect for lightweight applications or when deploying to servers like WildFly where you don’t want Spring dependencies.
Let me know if you'd like a ZIP template or instructions for deploying to WildFly specifically!