Skip to content
This repository has been archived by the owner on Nov 2, 2024. It is now read-only.

simasch/vaadin-jooq-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vaadin/jOOQ Template

This repo has been moved to https://github.com/martinellich/vaadin-jooq-template

Introduction

This is a template project that shows how to integrate Vaadin and jOOQ and how to test it with Karibu Testing and Playwright.

It uses Testcontainers for generating the jOOQ classes and integration testing and Flyway for the database migrations.

This project can be used as a starting point to create your own Vaadin application with jOOQ. It contains all the necessary configuration and some examples to get you started.

Running the Application

Before running the application, the jOOQ metamodel has to be generated using the Maven plugin:

./mvnw compile

Then you can simply run the application with a database started by Testcontainers from your IDE using the TestVjApplication.

Important: This class uses the Spring Boot Testcontainers support, introduced with Spring Boot 3.1. Thus, Docker or Testcontainers Cloud must be running on your local computer.

Testing the Application

There are two base classes:

  • KaribuTest can be used for fast browser-less testing, aka UI unit test. Karibu sets up a Vaadin mock environment.
  • PlaywrightIT configures Playwright for E2E tests. This class uses SpringBootTest at a random port.

The Playwright test uses Mopo, which simplifies the testing of Vaadin applications with Playwright.

Deploying to Production

To create a production build, call mvnw clean package -Pproduction (Windows), or ./mvnw clean package -Pproduction (Mac & Linux).

This will build a JAR file with all the dependencies and front-end resources, ready to be deployed. You can find the file in the target folder after the build completes.

Once the JAR file is built, you can run it using java -jar target/vaadin-jooq-template-<version>.jar

Project structure

  • layout/MainLayout.java in src/main/java contains the navigation setup using App Layout.
  • views package in src/main/java contains the server-side Java views of your application.
  • themes folder in frontend/ contains the custom CSS styles.

Security Configuration

The example uses JWT authentication for a better developer experience (for example, you don't have to re-login during development). Read more in the blog of Matti Tahvonen.

Useful links

Vaadin

jOOQ

Spring Boot

Testcontainers

Karibu Testing

Playwright

About

Template Project that integrates Vaadin and jOOQ

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages