How to Migrate a Spring Boot JPA App to Quarkus for Faster Startup

This guide demonstrates step‑by‑step how to transform a Spring Boot application that uses JPA for CRUD operations into a Quarkus‑based microservice, covering Maven dependencies, configuration changes, main class adaptation, and optional extensions such as actuator health checks and Flyway migrations.

Java Architecture Diary
Java Architecture Diary
Java Architecture Diary
How to Migrate a Spring Boot JPA App to Quarkus for Faster Startup

Quarkus is a hot Java application framework positioned as a lightweight microservice framework, offering excellent container integration, faster startup, lower memory consumption, and shorter response times compared to traditional frameworks like Spring Boot.

Quarkus performance comparison
Quarkus performance comparison

This article demonstrates how to migrate a Spring Boot application to Quarkus.

Spring Boot Sample Application

Using JPA to perform CRUD operations, the basic code is as follows:

Maven dependencies

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
</dependency>

JPA CRUD

public interface DemoUserDao extends CrudRepository<DemoUser, Long> {
}

Migration to Quarkus

quarkus-bom manages all Quarkus plugin Maven version information; after adding it, individual dependencies no longer need version definitions.

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-bom</artifactId>
      <version>1.10.5.Final</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

Migrate spring-web and spring-data-jpa to the Quarkus stack.

<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-spring-data-jpa</artifactId>
</dependency>
<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-spring-web</artifactId>
</dependency>

Configuration file adjustments (still in application.yml)

quarkus.datasource.db-kind=mysql
quarkus.datasource.jdbc.driver=com.mysql.cj.jdbc.Driver
quarkus.datasource.username=root
quarkus.datasource.password=root
quarkus.datasource.jdbc.url=jdbc:mysql://localhost:3306/pig_demo?useUnicode=true&characterEncoding=utf8&autoReconnect=true&rewriteBatchedStatements=TRUE

Main method adjustment to implement QuarkusApplication and keep the service running with Quarkus.waitForExit().

@QuarkusMain
public class SimpleApplication implements QuarkusApplication {
  public static void main(String[] args) {
    Quarkus.run(SimpleApplication.class, args);
  }
  @Override
  public int run(String... args) {
    Quarkus.waitForExit();
    return 0;
  }
}

Running the Application

The main method starts the application and prints the Quarkus banner.

__  ____  __  _____   ___  __ ____  ______
--/ __ \/ / / / _ | /_  \/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/,< /_/_ /\ 
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2021-01-12 22:31:46,341 INFO  [io.qua.arc.pro.BeanProcessor] (build-21) Found unrecommended usage of private members (use package-private instead) in application beans:
 - @Inject field com.example.simple.controller.DemoController#userDao
2021-01-12 22:31:48,702 INFO  [io.quarkus] (Quarkus Main Thread) Quarkus 1.10.5.Final on JVM started in 4.613s. Listening on: http://localhost:8080
2021-01-12 22:31:48,703 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-01-12 22:31:48,703 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [agroal, cdi, hibernate-orm, hibernate-orm-panache, mutiny, narayana-jta, resteasy, resteasy-jackson, smallrye-context-propagation, spring-data-jpa, spring-di, spring-web]

It is important that the installed features are displayed.

Installed features: [agroal, cdi, hibernate-orm, hibernate-orm-panache, mutiny, narayana-jta, resteasy, resteasy-jackson, smallrye-context-propagation, spring-data-jpa, spring-di, spring-web]

Extension: Actuator Monitoring Migration

Add the following dependency

<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-smallrye-health</artifactId>
</dependency>

Specify the health endpoint path

quarkus.smallrye-health.root-path=/actuator/health

Test the health endpoint

curl http://localhost:8080/actuator/health
{
  "status": "UP",
  "checks": [
    {
      "name": "Database connections health check",
      "status": "UP"
    }
  ]
}

Extension: Flyway Migration

Add the Quarkus Flyway plugin

<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-flyway</artifactId>
</dependency>

Set the plugin to migrate at start

quarkus.flyway.migrate-at-start=true
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

javamigrationSpring BootQuarkusjpa
Java Architecture Diary
Written by

Java Architecture Diary

Committed to sharing original, high‑quality technical articles; no fluff or promotional content.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.