Backend Development 7 min read

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

<code>&lt;dependency&gt;
  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
&lt;/dependency&gt;
</code>

JPA CRUD

<code>public interface DemoUserDao extends CrudRepository&lt;DemoUser, Long&gt; {
}
</code>

Migration to Quarkus

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

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

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

<code>&lt;dependency&gt;
  &lt;groupId&gt;io.quarkus&lt;/groupId&gt;
  &lt;artifactId&gt;quarkus-spring-data-jpa&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
  &lt;groupId&gt;io.quarkus&lt;/groupId&gt;
  &lt;artifactId&gt;quarkus-spring-web&lt;/artifactId&gt;
&lt;/dependency&gt;
</code>

Configuration file adjustments (still in application.yml)

<code>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&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;rewriteBatchedStatements=TRUE
</code>

Main method adjustment to implement

QuarkusApplication

and keep the service running with

Quarkus.waitForExit()

.

<code>@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;
  }
}
</code>

Running the Application

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

<code>__  ____  __  _____   ___  __ ____  ______
--/ __ \/ / / / _ | /_  \/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/,< /_/_ /\ 
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
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]
</code>

It is important that the installed features are displayed.

<code>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]
</code>

Extension: Actuator Monitoring Migration

Add the following dependency

<code>&lt;dependency&gt;
  &lt;groupId&gt;io.quarkus&lt;/groupId&gt;
  &lt;artifactId&gt;quarkus-smallrye-health&lt;/artifactId&gt;
&lt;/dependency&gt;
</code>

Specify the health endpoint path

<code>quarkus.smallrye-health.root-path=/actuator/health
</code>

Test the health endpoint

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

Extension: Flyway Migration

Add the Quarkus Flyway plugin

<code>&lt;dependency&gt;
  &lt;groupId&gt;io.quarkus&lt;/groupId&gt;
  &lt;artifactId&gt;quarkus-flyway&lt;/artifactId&gt;
&lt;/dependency&gt;
</code>

Set the plugin to migrate at start

<code>quarkus.flyway.migrate-at-start=true
</code>
JavaMigrationMicroservicesSpring 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

login 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.