Improving First Request Latency in Java Spring Application

I was recently facing a problem with first requests into a double entry financial ledger service taking more than double of subsequent requests. This got me digging into Java’s Ahead-Of-Time Cache (AOT) and Spring. I was under the wrong impression that AOT is only about startup speedup, but looking a bit through recent AOT JEP additions found out each one will bring something to the first request. JEP 483: Ahead-of-Time Class Loading & Linking (JDK 24) JEP 515: Ahead-of-Time Method Profiling (JDK 25) JEP 516: Ahead-of-Time Object Caching with Any GC (JDK 26) So here’s the setup: ...

September 3, 20264 min

Decouple Maven Releases from Version Logic

In standard Maven projects, versions are hardcoded in the POM, requiring a manual update after every release. This workflow is prone to several issues that often complicate CI/CD pipelines. I will explain why this approach is problematic and show a better way to handle releases by decoupling the version and Git operations from Maven. Let’s first revise what Maven offers out of the box, namely the maven-release-plugin workflow: Change version from 0.1.0-SNAPSHOT to 0.1.0. Commit the change and create a Git release tag. Build and push the tagged version to the repository. Bump the version to 0.1.1-SNAPSHOT and commit again. Issues with Maintaining Hardcoded Versions in POM Noise in Git History Tags are required as they mark a point in Git history where we can reliably track releases. Version change commits, on the other hand, are not used in any context and add noise. ...

January 2, 20264 min

CrOp 0.1.3: Adding Result Counts and a Look at API Trade-offs

I’m happy to share that I’ve added a new feature to CrOp and also moved it to a new namespace. In my previous articles, I explained what problem it solves in a typical REST service. At the time, I was still missing a way to count the total result. This is a must-have in a paginated query. @Query from Spring Data JPA, for example, has a separate attribute for that - countQuery. Seems trivial now, as any problem in retrospect, but at the time I was getting SqmRoot not yet resolved to TableGroup error. And that was because I was using the wrong root to apply predicates for count. Storing predicates as a function that accepts another root allowed me to reapply them for count. ...

December 22, 20253 min

Java Database Search Made Easy

Search functionality is so ubiquitous in any web app that at some point you start asking yourself if it can be done any easier. Introducing CrOp, a lightweight, zero dependency, and type-safe wrapper around Java Persistence Criteria API, which simplifies building queries, particularly useful within REST SQL (RSQL) context. Let’s dive into it’s core principles. Zero Dependency We all know the pain of upgrading dependencies. What I find the most troublesome is going through compatibility matrices (if you are lucky enough to find them). For example, you can’t use Spring 3 with Hibernate 5. And if you built something with Hibernate 5, you’ll have to rewrite it before upgrading Spring. ...

July 14, 20243 min

How to Organize the Code in the Ports and Adapters Architecture

In this article, we’ll have a look at how to separate an application into different modules so that it can be developed and tested in isolation of any external dependencies. As a result, we’ll obtain loosely coupled components where things like database and communication protocol can easily be replaced without any changes in the domain logic. First of all, let’s introduce a user story so that the domain logic of the example will be clear from the start: ...

May 1, 20213 min