The application from the last post was a simple command-line “Hello World” application.
Let’s build something more sophisticated by creating a Vaadin application.
First, create the project directory and a build.gradle file:
mkdir hello-vaadin
cd hello-vaadin
touch build.gradle
The build.gradle file needs the following content:
plugins {
id "fi.jasoft.plugin.vaadin" version "1.1.9"
}
Check all available tasks with gradle tasks --all.
Create the project with gradle vaadinCreateProject, then build and run it with gradle vaadinRun.
A browser should open at http://localhost:8080/?debug.
I then changed the package path from com.example.hellovaadin to my organization’s package com.rampmeupscotty.blog.hellovaadin using IntelliJ’s automatic rename. Everything was updated automatically except one line:
@WebInitParam(name="ui", value="HelloVaadinUI")
This needs to be changed to the fully qualified class name:
@WebInitParam(name="ui", value="com.rampmeupscotty.blog.hellovaadin.HelloVaadinUI")
Before refactoring it had been:
@WebInitParam(name="ui", value="com.example.hellovaadin.HelloVaadinUI")
Then follow the official tutorial to get started with coding.
If you want more, replace the tutorial’s demo backend with a real database using the Spring guide: https://spring.io/guides/gs/crud-with-vaadin/.
Done for today!