/examples

Example code for the Quarkus for Spring Developers eBook

Primary LanguageJavaApache License 2.0Apache-2.0

Example code for the Quarkus for Spring Developers eBook. Code is organized by chapter. Each project is self-contained, meaning there is no parent/child structure amongst projects.

Versions

Whenever possible, versions of Quarkus and Spring used in these examples are kept up-to-date as much as possible. The frameworks may have evolved since the book's writing and perhaps there is a better/different way to do something than what is shown in the book's code excerpts. The code in this repository will be kept in sync with what is shown in the book so that those examples may be replicated successfully. As new editions of the book are published, examples may be changed to reflect new patterns.

Here is a summary of some of the new features which may affect the examples in the book. The examples in this repo won't be updated to take advantage of these capabilities until a new revision of the book is released.

Quarkus

  • RESTEasy Reactive - to block or not to block
    • New features in RESTEasy Reactive allow Quarkus to automatically detect whether a method is blocking or non blocking
    • Starting with Quarkus 2.2, this means that the @Blocking annotation used in many of the Quarkus examples is no longer needed. Quarkus will "figure it out" on its own.
  • Panache Reactive with Hibernate Reactive
    • The Quarkus reactive examples in chapter 4 using Panache Reactive currently use a custom built class for implementing transaction rollback within tests.
    • Quarkus now includes an @TestReactiveTransaction annotation that can automatically rollback transactions within tests, similar to how the @TestTransaction annotation works in the Hibernate ORM examples in chapter 4.
  • quarkus.hibernate-orm.database.generation will default to drop-and-create when Dev Services is in use.
  • @NativeImageTest has been deprecated in favor of @QuarkusIntegrationTest
  • The maven-failsafe-plugin has been moved out of the native Maven profile and into the main profile.

Spring

  • The implementation of chapter-5s Spring Kafka test example had to be modified to use KafkaContainer instead of DockerComposeContainer due to docker compose "flakiness" that was happening within the GitHub Actions CI/CD process. The Spring Kafka tests were continually failing within the CI/CD process.
  • Spring Boot 3/Spring 6/Spring Cloud 2022.0 has shipped but would have an impact on the examples in the book, plus would require Java 17, therefore the examples will not yet be updated to those versions.

Book Chapter Text

The table below describes the versions of the example snippets used in the book's chapter text:

Framework Version
Quarkus 2.1.4.Final
Spring Boot 2.5.4

Examples Repo

The table below describes the versions of the examples in this repo:

Framework Version
Quarkus 2.16.12.Final
Spring Boot 2.7.16

Chapter List