This is an example project that can be used as a starting point to create your own Vaadin application with Spring Boot. It contains all the necessary configuration and some placeholder files to get you started.
There are two ways to run the application : using mvn spring-boot:run
or by running the Application
class directly from your IDE.
You can use any IDE of your preference,but we suggest Eclipse or Intellij IDEA.
Below are the configuration details to start the project using a spring-boot:run
command. Both Eclipse and Intellij IDEA are covered.
- Right click on a project folder and select
Run As
-->Maven build..
. After that a configuration window is opened. - In the window set the value of the Goals field to
spring-boot:run
- You can optionally select
Skip tests
checkbox - All the other settings can be left to default
Once configurations are set clicking Run
will start the application
- On the right side of the window, select Maven --> Plugins-->
spring-boot
-->spring-boot:run
goal - Optionally, you can disable tests by clicking on a
Skip Tests mode
blue button.
Clicking on the green run button will start the application.
After the application has started, you can view your it at http://localhost:8080/ in your browser.
If you want to run the application locally in the production mode, use spring-boot:run -Pproduction
command instead.
Integration tests are implemented using Vaadin TestBench. The tests take a few minutes to run and are therefore included in a separate Maven profile. We recommend running tests with a production build to minimize the chance of development time toolchains affecting test stability. To run the tests using Google Chrome, execute
mvn verify -Pit,production
and make sure you have a valid TestBench license installed.
Profile it
adds the following parameters to run integration tests:
-Dwebdriver.chrome.driver=path_to_driver
-Dcom.vaadin.testbench.Parameters.runLocally=chrome
If you would like to run a separate test make sure you have added these parameters to VM Options of JUnit run configuration
Project follow the Maven's standard directory layout structure:
- Under the
srs/main/java
are located Application sourcesApplication.java
is a runnable Java application class and a starting pointGreetService.java
is a Spring service classMainView.java
is a default view and entry point of the application
- Under the
srs/test
are located test files src/main/resources
contains configuration files and static resources- The
frontend
directory in the root folder contains client-side dependencies and resource files- All CSS styles used by the application are located under the root directory
frontend/styles
- Templates would be stored under the
frontend/src
- All CSS styles used by the application are located under the root directory
- Vaadin Basics https://vaadin.com/docs
- More components at https://vaadin.com/components and https://vaadin.com/directory
- Download this and other examples at https://vaadin.com/start
- Using Vaadin and Spring https://vaadin.com/docs/v14/flow/spring/tutorial-spring-basic.html article
- Join discussion and ask a question at https://vaadin.com/forum
If you run application from a command line, remember to prepend a mvn
to the command.
Remember to set jdk 11 as java home
export JAVA_HOME="/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/"
export PATH="$JAVA_HOME/bin:$PATH"
https://dzone.com/articles/hot-swap-java-bytecode-on-runtime
Basically,
- Download the appropriate release for your OS from here https://github.com/TravaOpenJDK/trava-jdk-11-dcevm/releases/tag/dcevm-11.0.7%2B1.
- Configure your IDE to use that runtime instead
mvn package -Pproduction
java -jar target/my-todo-1.0-SNAPSHOT-spring-boot.jar
gcloud beta compute --project=dixit-280012 instances create-with-container dixit-docker --zone=us-east1-b --machine-type=f1-micro --subnet=default --network-tier=PREMIUM --metadata=google-logging-enabled=true --maintenance-policy=MIGRATE --service-account=[email protected] --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append --image=cos-stable-81-12871-119-0 --image-project=cos-cloud --boot-disk-size=10GB --boot-disk-type=pd-standard --boot-disk-device-name=dixit-docker --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --container-image=docker.io/jontejj/dixit:sha-1f9fecd --container-restart-policy=always --container-tty --labels=container-vm=cos-stable-81-12871-119-0 --reservation-affinity=any
https://github.com/GoogleCloudPlatform/github-actions/blob/master/example-workflows/gce/README.md
docker run --rm -ti --name zalenium -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/videos:/home/seluser/videos --privileged dosel/zalenium start