Transferify
Back to blog

How we moved our backend from Quarkus 3 to Quarkus 4 in a day

On 28 November 2026 our backend moved from Quarkus 3.40.1 to Quarkus 4.0.1, and it was in production the same day, three days after Quarkus 4.0.1 came out. This post is for a team that is still on Quarkus 3: what the move took, what Quarkus did for us, what we had to do by hand, and what we would tell you before you start.

The move was quick because Quarkus did most of the work. The update recipe changed 93 files in 29 seconds. Quarkus Data gave us repositories that are checked when we build. Plain gRPC, which Quarkus still supports, let us drop Mutiny, and Quarkus 4 and Vert.x 5 let us delete two small classes of our own. And the native image still builds.

What moved, and in what order

We changed four things, and they went out in three batches:

  1. 27 November: Mutiny out. We removed Mutiny from our gRPC services and shipped that alone, so the Quarkus move did not have to carry it.
  2. 28 November: the Quarkus version. Quarkus 3.40.1 became 4.0.1, with Hibernate ORM 8, Jackson 3 and Vert.x 5 coming with it.
  3. 28 November, in the same change: data access. Every module now reads and writes through Quarkus Data repositories: 61 of them, with one persistence unit and one database schema for each module.
  4. 28 November, later: readability. Lombok, SLF4J, NullAway and Awaitility, on top of the new version.

The update recipe did the mechanical part

Quarkus has its own migration tool, quarkus update. It builds a recipe for your project and applies it with OpenRewrite. The update guide says plainly that the command automates only a subset of a migration, and the Quarkus 4.0 migration guide marks every item the command handles by itself.

On our Gradle 9 build, the step that applies the recipe stopped on tooling problems: it looked for the wrapper in the wrong folder, its init script did not run, and one Hibernate step failed on an empty beans.xml. The recipe Quarkus had generated was usable, so we ran it through OpenRewrite ourselves, with a small init script that skips the empty file. It changed 93 files in 29 seconds.

Almost all of it was the move from Jackson 2 to Jackson 3: new package names (tools.jackson in place of com.fasterxml.jackson), renamed methods, and exceptions that are no longer checked. It also set both Quarkus versions in gradle.properties.

Some things were ours. Quarkus 4 removed the separate gRPC server and its setting, so we deleted that line. A few Vert.x 5 methods and types we used had changed. And some defaults changed: Jackson 3 refuses a JSON document that has extra content after it, where Jackson 2 ignored the extra content, so we set quarkus.jackson.fail-on-trailing-tokens to false, because we read the answers of other companies' services.

To prove the service still answered the same, we wrote a probe that calls every one of our 106 RPCs with an empty request and records the status code, the message and the error details. We ran it before and after. The two lists were identical.

Quarkus Data: one interface for each table

Before the move, our data access was a mix of Spring Data repositories, through the Quarkus compatibility extension, and hand-written JDBC. Quarkus Data is built on Jakarta Data: you write an interface, mark its methods with @Find, @Query or @NativeQuery (the last one comes from Jakarta Persistence), and an annotation processor checks the queries and writes the implementation when you build.

Spring Data's compatibility layer could not run native SQL or row locks on a named persistence unit for us, so a repository often needed a hand-written class beside it:

// Before: a Spring Data repository, plus a class for what it could not run
public interface TransferRepository
        extends JpaRepository<TransferRecord, UUID>, TransferQueries {

    @Modifying(clearAutomatically = true)
    @Query("delete from TransferRecord t where t.ownerId = ?1")
    long deleteOf(UUID ownerId);
}

class TransferQueriesImpl implements TransferQueries {
    private final EntityManager entities;

    TransferQueriesImpl(@PersistenceUnit("transfers") EntityManager entities) {
        this.entities = entities;
    }

    public long lockedRevision(UUID id) {
        return ((Number) entities
            .createNativeQuery("SELECT revision FROM transfers WHERE id = :id FOR UPDATE")
            .setParameter("id", id).getSingleResult()).longValue();
    }

    public void setRevision(UUID id, long revision) {
        entities.createQuery("update TransferRecord t set t.revision = :revision where t.id = :id")
            .setParameter("revision", revision).setParameter("id", id).executeUpdate();
        entities.clear(); // a bulk update skips the persistence context
    }
}

With Quarkus Data the same table is one interface:

// After: one interface, on the persistence unit named "transfers"
@Repository(dataStore = "transfers")
public interface TransferRepository {

    @Find
    Optional<TransferRecord> findById(@By(By.ID) UUID id);

    @NativeQuery("SELECT revision FROM transfers WHERE id = :id FOR UPDATE")
    long lockedRevision(UUID id);

    @Query("update TransferRecord set revision = :revision where id = :id")
    void setRevision(UUID id, long revision);

    @Query("delete from TransferRecord where ownerId = :ownerId")
    long deleteOf(UUID ownerId);
}

The line that cleared the persistence context is gone too: a Quarkus Data repository runs on a stateless session, which keeps no cache, so a bulk update leaves no stale entity behind. We now have 61 repositories and 61 entities, no Spring import and no persistence method on any entity. Flyway still creates and changes the tables. Hibernate never does: each persistence unit only validates its entities against the migrated schema.

Dropping Mutiny, keeping virtual threads

Our gRPC methods were already plain blocking code running on virtual threads. We wrapped each answer in a Mutiny Uni only because the generated base class asked for one. Quarkus still lets you write a service with the plain gRPC API, and @RunOnVirtualThread moves each call to a virtual thread. So we took the Mutiny stubs out of code generation, extended gRPC Java's own base class, answered through its StreamObserver, and put one annotation on the service class to cover every call:

@GrpcService
@RunOnVirtualThread
public class TransferGrpcService extends TransferServiceGrpc.TransferServiceImplBase {
    @Override
    public void getTransfer(GetTransferRequest request, StreamObserver<GetTransferResponse> observer) {
        Replies.send(observer, transfers.answer(request));
    }
}

Replies.send is the one line every RPC ends with: it calls onNext and then onCompleted. A test checks that every RPC runs on a virtual thread, and on Java 25 a blocking call on a virtual thread is cheap.

Quarkus 4 removed the separate gRPC server, so gRPC now runs on the same Vert.x HTTP server as everything else. We were already set up that way, so no port moved. Two small classes of our own went away because Quarkus 4 and Vert.x 5 do the job: Vert.x 5.2.3 refuses writes on a reset stream itself, so we deleted our guard for that, and the Quarkus 4 gRPC server puts the caller's deadline on the gRPC context, so we deleted our parser for the grpc-timeout header.

The native image still builds

Every push to our main branch builds the service as a native executable, runs the integration tests against it, builds the container image from it and starts that image to check that it boots, all before anything is deployed. The Quarkus 4.0.1 change went through the same steps and passed. The native-specific change in our code was small: a repository method that returns a plain record needs @RegisterForReflection on the record, or the first call fails in the native image.

Readability work on top

Once the move was in production, we used the rest of the day for changes that make the code easier to read. The aim was no change in behavior. For Lombok we checked it by comparing the list of members of every compiled class before and after, and the lists matched.

  • Lombok now writes about 1,100 getters and constructors that we used to type.
  • SLF4J loggers, written with @Slf4j, replaced the JBoss Logging field in 101 classes.
  • NullAway reported 466 places in the main code where a value could be null. We cleared all of them, and the build now fails on a new one in main code. One was a real bug: a scheduled job that could end on a NullPointerException.
  • Awaitility replaced almost all of the sleeps in our tests.
// Before: the getters and the constructor, written by hand
@Entity
public class TransferRecord {
    @Id
    private UUID id;
    private long revision;

    protected TransferRecord() {
    }

    public UUID getId() {
        return id;
    }

    public long getRevision() {
        return revision;
    }
}

// After: Lombok writes them
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class TransferRecord {
    @Id
    private UUID id;
    private long revision;
}

A test that waits for something no longer sleeps for a guessed time:

// Before: poll, and sleep between the polls
var deadline = System.nanoTime() + Duration.ofSeconds(10).toNanos();
while (meters.get("transfers.ready").gauge().value() != 1.0 && System.nanoTime() < deadline) {
    Thread.sleep(100);
}

// After: wait for the condition, for at most ten seconds
await().atMost(Duration.ofSeconds(10))
        .until(() -> meters.get("transfers.ready").gauge().value() == 1.0);

The main code stayed about the same size: about 67,000 lines of Java before the Mutiny change and about 68,000 after the readability work, with new features shipped in between.

What we would tell another team

  1. Ship what can ship alone, ahead of the move. We shipped the Mutiny removal on its own the day before, so on the day of the move we knew Mutiny was not the cause.
  2. Record what your service answers before you start. The probe of 106 RPCs answered one question for us with a yes or a no: did behavior change?
  3. Run quarkus update on a clean branch, and read the migration guide anyway. Pay attention to changed defaults. Quarkus 4 also assumes a newer database version by default, so set quarkus.datasource.db-version to the version you run.
  4. Run every repository call inside a transaction. Outside one, a lookup by id held its connection until the request ended, and the next transaction in the same call waited for the pool. We put @Transactional on every store method that calls a repository, unless every caller of it already runs in one.
  5. Check the versions under Quarkus Data. A repository method with an array parameter compiles and then fails at the call on Hibernate 8.0.0.CR2, so we pass a Collection and write IN (:ids).
  6. Do not disable a test to get green. Our suite grew from 2,146 to 2,252 test methods during the move, and none was disabled. The only tests that went away belonged to code we deleted, and new tests took their place.
  7. Watch the memory of your test run. Quarkus builds one test application for each test profile and set of test resources, and keeps it until the test JVM ends. Sharing test resources took us from 90 applications to 56.

Thank you, Quarkus team

Almost everything that went well came from Quarkus: the update recipe, Quarkus Data, virtual thread support for gRPC services, the Vert.x 5 gRPC stack, and a migration guide that listed what we had to change. Quarkus 4 and Vert.x 5 let us delete code of our own, which is the best result a framework upgrade can have.

We also tried to give something back. We added a minimal reproduction to an open Quarkus issue about native images and the results of repository queries, and another to an open Lombok issue about Error Prone failing on code that Lombok generates. Thank you to everyone who built Quarkus 4.

Frequently asked questions

Do I have to remove Mutiny before I move to Quarkus 4?

No. The Quarkus gRPC guide still shows the Mutiny API next to the plain gRPC API. We removed Mutiny because our service methods were already blocking code on virtual threads, and the Uni around each answer added nothing.

Does quarkus update do the whole move?

No, and the Quarkus guide says so. It automates a subset. For us it changed 93 files, almost all of them the move from Jackson 2 to Jackson 3. A removed setting, a few compile errors and some changed defaults were ours to fix.

Is Quarkus Data ready for production?

The Quarkus guide marks it experimental, and Quarkus 4.0.1 brings Hibernate ORM 8.0.0.CR2 and Jakarta Data 1.1.0-M4, which are pre-release versions. We run it in production behind a large test suite. Read the guide's note and decide for your own team.

Can Quarkus Data run native SQL and row locks on a named persistence unit?

Yes. A @NativeQuery method can hold a SELECT with FOR UPDATE, and the dataStore attribute of @Repository points a repository at a named persistence unit. Call them inside a transaction, so the lock is held until the commit.

Related pages

Back to top