<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:social="https://jdriven.com/ns/social">
    <id>https://jdriven.com/blog</id>
    <title>JDriven Blog</title>
    <link href="https://jdriven.com/blog/atom.xml" rel="self" />
    <updated>2026-10-31T06:00:00.000Z</updated>
    <generator uri="https://hexo.io/">Hexo</generator>
    <entry>
        <id>https://jdriven.com/blog/2026/10/The-JEP-401-change-javac-won-t-warn-you-about/</id>
        <title>The JEP 401 change javac won&#39;t warn you about</title>
        <social:hashtags>#Java #JEP401 #Valhalla</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/The-JEP-401-change-javac-won-t-warn-you-about/"/>
        <published>2026-10-31T06:00:00.000Z</published>
        <updated>2026-10-31T06:00:00.000Z</updated>
        <author>
            <name>Johan</name>
            <uri>https://jdriven.com/blog/author/jgk</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Project Valhalla seems to be on the verge of being incorporated into the JVM&amp;#8230;&amp;#8203; as a preview feature in JDK 28 that is.
This blog might be a bit premature, since it isn&amp;#8217;t likely &lt;code&gt;value&lt;/code&gt; types will be final in JDK 29.
Premature, yes, but the JEP is already worth a careful read.
I stumbled upon some interesting behavioral changes regarding equality.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;quoteblock&#34;&gt;
&lt;blockquote&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Traditionally, the purpose of the == operator was to test whether two referenced objects have the same identity.&lt;br&gt;
 &lt;br&gt;
&amp;#8230;&amp;#8203;&lt;br&gt;
 &lt;br&gt;
After the introduction of value objects, the purpose of the == operator is to test whether two referenced objects are indistinguishable.&lt;/p&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div class=&#34;attribution&#34;&gt;
&amp;#8212; JEP 401
&lt;/div&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Project Valhalla seems to be on the verge of being incorporated into the JVM&amp;#8230;&amp;#8203; as a preview feature in JDK 28 that is.
This blog might be a bit premature, since it isn&amp;#8217;t likely &lt;code&gt;value&lt;/code&gt; types will be final in JDK 29.
Premature, yes, but the JEP is already worth a careful read.
I stumbled upon some interesting behavioral changes regarding equality.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;quoteblock&#34;&gt;
&lt;blockquote&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Traditionally, the purpose of the == operator was to test whether two referenced objects have the same identity.&lt;br&gt;
 &lt;br&gt;
&amp;#8230;&amp;#8203;&lt;br&gt;
 &lt;br&gt;
After the introduction of value objects, the purpose of the == operator is to test whether two referenced objects are indistinguishable.&lt;/p&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div class=&#34;attribution&#34;&gt;
&amp;#8212; JEP 401
&lt;/div&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Quick recap&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Identity in Java is a very important concept in relation to mutability.
In short, it means the JVM creates an object every time you call &lt;code&gt;new&lt;/code&gt;, and, importantly, assigns it an identity.
If we ignore the complex things the garbage collector can do, we can think of the identity as the reference to the object.
When we read or change the object, the reference leads us to the same place on the heap.
When we want to know whether two variables refer to the same object, we compare their references, because identical references mean the same object.
The &lt;code&gt;equals&lt;/code&gt; method, on the other hand, delegates equality to the object itself: a class can override it.
By default &lt;code&gt;Object.equals&lt;/code&gt; compares the references, just like &lt;code&gt;==&lt;/code&gt;, but an overridden method can compare fields.
A &lt;code&gt;record&lt;/code&gt; automatically compares its fields using their &lt;code&gt;equals&lt;/code&gt; methods.
This leads to the following summary:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;var a = new Vec2(1,2);
var b = new Vec2(1,2);

println(a == b); // false, a and b were both created with new, hence their references are different
println(a.equals(b)); // true, the equals method compares equality of all record fields

private record Vec2(int a, int b) {}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The implications of changing equality&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;When I read how the JEP proposes to implement this change in equality, I immediately felt a little itch in the back of my mind.
This blog will try to show there are subtle issues that might arise when the definition of equality is changed without your library knowing about it.
Although the JEP does suggest ways to prevent these errors, I think it&amp;#8217;s optimistic to assume every library will upgrade based
on the advice in the JEP given the vast landscape of libraries in our ecosystem.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;In a nutshell&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;JEP 401, part of Project Valhalla, aims to add the possibility to remove &#34;identity&#34; from classes, including records.
Traditionally, using the &#34;==&#34; operator would compare &#34;referential equality&#34;.
It answers the question: Is this thing I have here the same as that thing over there?
Think of it as the two chairs next to your coffee table.
They might look exactly the same, but they are in fact different chairs.
In software and mathematics this distinction is less obvious. Java traditionally offered &lt;code&gt;.equals()&lt;/code&gt; to solve this.
Statements like &#34;4 == 4&#34;, &#34;[1,3] == [1,3]&#34;, &#34;1 == 3 - 2&#34; hold true and are completely oblivious to any identity the operands might have.
JEP 401 introduces &lt;code&gt;value&lt;/code&gt; types.
These types allow developers to opt out of identity, so Java referential equality expressions will work more like their mathematical counterparts.
Next to the conceptual change, this also has great potential for optimization in the JVM.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Some disclaimers&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I&amp;#8217;m not trying to attack JEP 401. I think the ideas it presents are interesting and I&amp;#8217;m excited for these new concepts to land in the JVM.
I&amp;#8217;m not predicting a wave of bugs, but I wouldn&amp;#8217;t be surprised if some of us encounter unexpected behavior caused by the situations I&amp;#8217;ll describe.
The code examples in this blog are simplified versions of obvious bad practices.
The JEP acknowledges the causes for the situations described in this blog, and does offer advice.
As far as I know it&amp;#8217;s not solved in the implementation.
Read this blog as my playground, experimenting with the implications of statements made in the JEP.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Equality behavior at runtime&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;As mentioned at the top of this blog, JEP 401 proposes to conceptually change equality, from having the same identity, to being indistinguishable.
In practice this means that two normal objects are indistinguishable when they have the same identity, and two &lt;code&gt;value&lt;/code&gt; objects are indistinguishable when their fields are the same.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;There are two things influencing how a JVM compares objects:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;olist arabic&#34;&gt;
&lt;ol class=&#34;arabic&#34;&gt;
&lt;li&gt;
&lt;p&gt;When compiling a class declared with &lt;code&gt;value&lt;/code&gt;, the compiler marks the class file as a value class. An identity class has the &lt;code&gt;ACC_IDENTITY&lt;/code&gt; access flag set, whereas a value class does not.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When running on a compatible JVM, in these examples JDK 28 with preview features enabled, the JVM will compare value objects as indistinguishable based on their fields.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The thing that immediately crossed my mind was the huge ecosystem of libraries surrounding the JVM.
All these libraries have different lifecycles, are maintained by professional teams and hobbyists alike, and form the community that makes Java and the JVM the welcoming platform it is.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;But what happens when a new JVM feature forces updates because it conceptually changes the runtime?&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Some hypothetical scenarios&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Company X-Games has been creating games based on Java for years now.
They are happily using the libraries YMath for their basic math types and ZMathGame, which adds utility for their games.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;YMath has just announced their new version, compiled with value classes.
X-Games is eager to adopt it, since YMath promises it will lower the memory footprint significantly.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Unfortunately, bug reports start flooding the company&amp;#8217;s mailbox.
Let&amp;#8217;s analyze what happened.
For these scenarios the game depends on the latest YMath (2.0.0), and the latest ZMathGame (1.0.0), which depends on YMath (1.0.0).&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;sect3&#34;&gt;
&lt;h4&gt;&#34;My black labels turn white in dark mode!?&#34;&lt;/h4&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;X-Games lets players pick a label color.
If they pick nothing, the label follows the theme. If they pick a color, that color wins.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package GameX;

Label label = new Label();
label.setColor(new Color(0, 0, 0));   // the player explicitly picks black

label.effectiveColor(darkTheme);      // black in YMath 1.0.0, white in YMath 2.0.0&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package YMath;

public final class Color {
    public static final Color DEFAULT = new Color(0, 0, 0);
    ...
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package ZMathGame;

public final class Label {
    private Color color = Color.DEFAULT;

    public void setColor(Color c) { color = c; }

    public Color effectiveColor(Theme theme) {
        return color == Color.DEFAULT ? theme.textColor() : color;
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The &lt;code&gt;effectiveColor&lt;/code&gt; method uses a constant and a comparison by identity to check whether the player chose a color.
&lt;code&gt;DEFAULT&lt;/code&gt; is black, but a player who explicitly picks black gets &lt;code&gt;new Color(0, 0, 0)&lt;/code&gt;.
Based on the old equality definition, that is a different instance than &lt;code&gt;DEFAULT&lt;/code&gt;, so the label stays black.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Then YMath 2.0.0 made &lt;code&gt;Color&lt;/code&gt; a value class.
The new equality definition defines both &lt;code&gt;Color&lt;/code&gt; instances as indistinguishable.
The label now follows the theme, which is white in the dark theme, so players who deliberately chose black get white labels.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect3&#34;&gt;
&lt;h4&gt;&#34;My guard never returns home!?&#34;&lt;/h4&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;X-Games has guards that patrol a route through the level, supported by ZMathGame.
A route is a list of waypoints, and a guard walks it for one lap, ending where it started.
Every waypoint is a &lt;code&gt;YMath.NodeGraph.Node&lt;/code&gt;, which the game asks the level&amp;#8217;s &lt;code&gt;NodeGraph&lt;/code&gt; for by grid position.
&lt;code&gt;YMath.NodeGraph.Node&lt;/code&gt; is a very basic Java class without &lt;code&gt;equals()&lt;/code&gt; and &lt;code&gt;hashCode()&lt;/code&gt;, so in YMath 1.0.0 it is compared by identity.
Nobody ever needed more, since &lt;code&gt;nodeAt(..)&lt;/code&gt; hands out a fresh node every time it is called.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package GameX;

Route route = new Route(levelGraph);
route.addWaypoint(1, 2);   // home
route.addWaypoint(1, 3);
route.addWaypoint(2, 3);
route.addWaypoint(1, 2);   // back home

route.walkOnce(guard);&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package YMath;

public class NodeGraph {
    public Node nodeAt(int x, int y) {
        return new Node(x, y);
    }

    public static class Node {
        final int x, y;
        Node(int x, int y) { this.x = x; this.y = y; }
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package ZMathGame;

public final class Route {
    private final NodeGraph levelGraph;
    private final List&amp;lt;Node&amp;gt; waypoints = new ArrayList&amp;lt;&amp;gt;();

    public void addWaypoint(int x, int y) {
        waypoints.add(levelGraph.nodeAt(x, y));
    }

    public void walkOnce(GameObject g) {
        Set&amp;lt;Node&amp;gt; reached = new HashSet&amp;lt;&amp;gt;();
        int step = 0;
        while (!reached.containsAll(waypoints)) {   // one lap: every waypoint reached
            Node next = waypoints.get(step++);
            g.walkTo(next);
            reached.add(next);
        }
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The &lt;code&gt;Route&lt;/code&gt; class creates a new &lt;code&gt;Node&lt;/code&gt; for every waypoint, including the last one that brings the guard back home.
When &lt;code&gt;route.walkOnce(guard)&lt;/code&gt; runs, ZMathGame keeps the waypoints the guard has reached in a &lt;code&gt;HashSet&lt;/code&gt;.
The lap is done once that set contains every waypoint of the route.
Because &lt;code&gt;Node&lt;/code&gt; does not override &lt;code&gt;equals()&lt;/code&gt; and &lt;code&gt;hashCode()&lt;/code&gt;, it inherits the ones from &lt;code&gt;Object&lt;/code&gt;.
In the old situation the first and the last waypoint were different nodes, even though they had the same x and y.
The set only contained every waypoint after the guard had walked all four of them, so the guard ended up at home.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Then YMath 2.0.0 made &lt;code&gt;Node&lt;/code&gt; a value class.
Since value objects are compared by their fields, it doesn&amp;#8217;t need an &lt;code&gt;equals()&lt;/code&gt;: the JVM provides one.
That makes the upgrade look completely harmless, but the first and the last waypoint are now equal.
After the third waypoint the &lt;code&gt;HashSet&lt;/code&gt; already contains every node in the route, so ZMathGame considers the lap done.
The guard stops at &lt;code&gt;(2,3)&lt;/code&gt; and never walks the last leg home.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;What to take from this blog?&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Let&amp;#8217;s first draw the conclusion.
When &lt;code&gt;value&lt;/code&gt; objects will eventually hit the LTS version of Java, the behavior of your libraries, and with them your application, can change without warnings or errors.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;ZMathGame was compiled against the old YMath, and swapping in YMath 2.0.0 in the game doesn&amp;#8217;t recompile ZMathGame, so javac never gets a chance to warn.
Even if ZMathGame were recompiled, the JEP lists no javac warning for &#34;==&#34; on value classes.
The behavior of &#34;==&#34; changes at run time, and nothing in the process warns about it.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;As mentioned, the JEP addresses these risks. Comparing based on object identity has been a bad practice for a long time
and the JEP advises libraries to override &lt;code&gt;equals()&lt;/code&gt; and &lt;code&gt;hashCode()&lt;/code&gt; before turning an identity class into a value class.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;This blog has mainly been my experiment to understand the implications of such a fundamental change to Java.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;To read the full JEP, see &lt;a href=&#34;https://openjdk.org/jeps/401&#34;&gt;JEP 401&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Java" scheme="https://jdriven.com/blog/category/Java/" />
        <category term="JEP401" scheme="https://jdriven.com/blog/category/JEP401/" />
        <category term="Valhalla" scheme="https://jdriven.com/blog/category/JEP401/Valhalla/" />
        <category term="Java" scheme="https://jdriven.com/blog/tag/Java/" />
        <category term="JEP401" scheme="https://jdriven.com/blog/tag/JEP401/" />
        <category term="Valhalla" scheme="https://jdriven.com/blog/tag/Valhalla/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/Hibernate-and-Collections/</id>
        <title>Hibernate and Collections</title>
        <social:hashtags>#Database #ORM #Hibernate #SoftwareDevelopment #JPA #Collections</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/Hibernate-and-Collections/"/>
        <published>2026-10-30T00:00:00.000Z</published>
        <updated>2026-10-30T00:00:00.000Z</updated>
        <author>
            <name>Ronald</name>
            <social:twitter>kqosh1</social:twitter>
            <uri>https://jdriven.com/blog/author/ronald-koster</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;When adding/removing entities to/from a collection in Hibernate one may easily run into annoying
&lt;code&gt;TransientObjectException&lt;/code&gt; or &lt;code&gt;TransientPropertyValueException&lt;/code&gt; exceptions.
This blog uses a simple example to describes how to avoid these issues.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;When adding/removing entities to/from a collection in Hibernate one may easily run into annoying
&lt;code&gt;TransientObjectException&lt;/code&gt; or &lt;code&gt;TransientPropertyValueException&lt;/code&gt; exceptions.
This blog uses a simple example to describes how to avoid these issues.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Data Model&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Suppose you have the following data model:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;imageblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;/blog/uploads/2024/12/Company-Employee.png&#34; alt=&#34;Company-Employee.png&#34; width=&#34;60%&#34;&gt;
&lt;/div&gt;
&lt;div class=&#34;title&#34;&gt;Figure 1. Data Model&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;With the following Java code:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;import jakarta.persistence.Column;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.MappedSuperclass;

@MappedSuperclass
public abstract class BaseEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = &#34;id&#34;, updatable = false, nullable = false)
    private Long id;

    // Immutable ID, set upon &#39;new&#39;, independent from DB
    @Column(name = &#34;business_key&#34;, nullable = false, unique = true, updatable = false)
    private String businessKey = UUID.randomUUID().toString();

    public Long getId() {
        return id;
    }

    public String getBusinessKey() {
        return businessKey;
    }

    @Override
    public final boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null || !(obj instanceof BaseEntity)) return false;
        BaseEntity other = (BaseEntity) obj;
        return Objects.equals(this.getBusinessKey(), other.getBusinessKey());
    }

    @Override
    public final int hashCode() {
        return Objects.hashCode(getBusinessKey());
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.OneToMany;

@Entity
public class Company extends BaseEntity{

    @Column(name = &#34;name&#34;, length = 100, nullable = false)
    public String name;

    @OneToMany(mappedBy = &#34;company&#34;, cascade = CascadeType.ALL, orphanRemoval = true)
    public Set&amp;lt;Employee&amp;gt; employees;
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.ForeignKey;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;

@Entity
public class Employee extends BaseEntity {

    @Column(name = &#34;first_name&#34;, length = 100, nullable = false)
    public String firstName;

    @Column(name = &#34;last_name&#34;, length = 100, nullable = false)
    public String lastName;

    @Column(name = &#34;email&#34;, length = 100, nullable = false)
    public String email;

    @ManyToOne
    @JoinColumn(foreignKey = @ForeignKey(name = &#34;fk_employee_company&#34;))
    public Company company;
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The Problem&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Until Hibernate version 6.5.3.Final the following code used to work:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;import jakarta.persistence.EntityNotFoundException;
import org.springframework.transaction.annotation.Transactional;

public class CompanyService {

    @Transactional
    public addEmployee(long companyId, String firstName, String lastName, String email) {
        var company = repository.findById(companyId);

        var employee = new Employee();
        employee.firstName = firstName;
        employee.lastName = lastName;
        employee.email = email;

        company.employees.add(employee);

        // cascade = CASCADE_ALL ensures this will persist the new employee as well.
        repository.save(company);
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;But in more recent versions of Hibernate this will likely result in a &lt;code&gt;TransientObjectException&lt;/code&gt; or &lt;code&gt;TransientPropertyValueException&lt;/code&gt; exception.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The Solution&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;To avoid these exceptions also set &lt;code&gt;employee.company&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;import jakarta.persistence.EntityNotFoundException;
import org.springframework.transaction.annotation.Transactional;

public class CompanyService {

    @Transactional
    public void addEmployee(long companyId, String firstName, String lastName, String email) {
        var company = repository.findById(companyId).orElseThrow(() -&amp;gt; new EntityNotFoundException(&#34;Company not found&#34;));

        var employee = new Employee();
        employee.firstName = firstName;
        employee.lastName = lastName;
        employee.email = email;

        // Link the relationship on both sides.
        employee.company = company;
        company.employees.add(employee);

        // cascade = CASCADE_ALL ensures this will persist the new employee as well.
        repository.save(company);
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;A similar issues may arise when removing an entity from the collection. So in that case also set &lt;code&gt;employee.company&lt;/code&gt; to &lt;code&gt;null&lt;/code&gt; like this:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;import jakarta.persistence.EntityNotFoundException;
import org.springframework.transaction.annotation.Transactional;

public class CompanyService {

    // other methods

    @Transactional
    public void removeEmployee(long companyId, long employeeId) {
        var company = repository.findById(companyId).orElseThrow(() -&amp;gt; new EntityNotFoundException(&#34;Company not found&#34;));

        var employee = company.emplyees.stream()
            .filter(em -&amp;gt; em.getId() == employeeId)
            .findFirst()
            .orElse(null);

        if (employee != null) {
            // Unlink the relationship on both sides.
            company.emplyees.remove(employee);
            employee.company = null;
        }
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Software Development" scheme="https://jdriven.com/blog/category/Software-Development/" />
        <category term="Database" scheme="https://jdriven.com/blog/category/Software-Development/Database/" />
        <category term="JPA" scheme="https://jdriven.com/blog/category/Software-Development/Database/JPA/" />
        <category term="Hibernate" scheme="https://jdriven.com/blog/category/Software-Development/Database/JPA/Hibernate/" />
        <category term="ORM" scheme="https://jdriven.com/blog/category/Software-Development/Database/JPA/Hibernate/ORM/" />
        <category term="Collections" scheme="https://jdriven.com/blog/category/Software-Development/Database/JPA/Hibernate/ORM/Collections/" />
        <category term="Database" scheme="https://jdriven.com/blog/tag/Database/" />
        <category term="ORM" scheme="https://jdriven.com/blog/tag/ORM/" />
        <category term="Hibernate" scheme="https://jdriven.com/blog/tag/Hibernate/" />
        <category term="Software Development" scheme="https://jdriven.com/blog/tag/Software-Development/" />
        <category term="JPA" scheme="https://jdriven.com/blog/tag/JPA/" />
        <category term="Collections" scheme="https://jdriven.com/blog/tag/Collections/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/score/</id>
        <title>Room to fail</title>
        <social:hashtags>#AI #Techradar</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/score/"/>
        <published>2026-10-29T06:56:00.000Z</published>
        <updated>2026-10-29T06:56:00.000Z</updated>
        <author>
            <name>Erik</name>
            <social:mastodon>erikj@mastodon.nl</social:mastodon>
            <uri>https://jdriven.com/blog/author/erik-pronk</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Last weekend I was in London with my daughter for a lovely couple of days and a Bon Jovi concert.
We were sitting together in a Costa Coffee when a young couple sat down across us.
At first I did not really notice them, only that there were these odd little sounds that kept repeating.
Then it clicked, when they stood up and started filming their TikTok dance, the sound turned up loud, with eyes only for the phone that had been carefully positioned for the perfect shot.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Last weekend I was in London with my daughter for a lovely couple of days and a Bon Jovi concert.
We were sitting together in a Costa Coffee when a young couple sat down across us.
At first I did not really notice them, only that there were these odd little sounds that kept repeating.
Then it clicked, when they stood up and started filming their TikTok dance, the sound turned up loud, with eyes only for the phone that had been carefully positioned for the perfect shot.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I have been turning that small moment over in my head ever since, and not because I want to complain about young people.
I am genuinely curious about what it says, because I think it points at something bigger than one couple in a coffee shop.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;A mentality worth looking at&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;What struck me was not the dance itself, but the complete absence of the room around them.
It is the same thing I notice more often lately.
The phone always in hand, the video call on speaker in a quiet carriage, a way of moving through the world that is very focused on the self and has little eye for the people nearby.
Alongside that I notice something else, which is a discomfort with criticism, and an assumption that things are basically fine as they are.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Let me be careful here, because it would be easy and lazy to turn this into &#34;everything was better in my day&#34;.
It was not, and every generation has heard that from the one before it.
This generation grew up with tools and skills I can only admire, and plenty of them care deeply about their work and the world.
So I am not looking to judge, I am trying to understand.
And when I sit with it honestly, part of what I see is something we built for them, not something they invented.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;When failure is quietly removed&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;We have slowly created a world where everything has to be positive.
A poor result cannot be delivered too plainly, because the worry is that it will be too much to handle.
Feedback gets softened until there is little left of it.
Even in sport I see it, where the score is played down and there is no winner and no loser, because apparently the score should not matter.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I understand the good intention behind all of this, which is to protect people and to keep them motivated.
But I do wonder what we give away when we take it too far.
Because a score is not there to make someone feel small.
A score, and the honest possibility of losing, is what gives an effort its meaning and gives us a reason to get better.
If nothing can be lost, it becomes hard to say that anything has really been won.
And if everything is already good enough, why would anyone reach for something more?&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;My concern, and I put it no stronger than that, is that this quietly nudges us all towards the middle.
Towards results that are fine, that work, that pass.
And away from the kind of work that is actually special.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Why this touches our craft&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I care about this because our profession lives on the opposite instinct.
Good software is built on fundamentals, on the willingness to hear that something is not right yet, and on rewriting a piece until it truly holds instead of settling for &#34;it works&#34;.
Quality comes from being able to fail, to take feedback seriously, and to keep refining long after the thing runs.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Honest feedback, even when it stings a little, is one of the most respectful gifts a colleague can give you.
It says they took your work seriously enough to look closely.
If we lose the ability to give and receive that, we do not become kinder, we just get quietly worse together.
This is close to something I wrote about before, in &lt;a href=&#34;https://jdriven.com/blog/2026/10/solo/&#34;&gt;The solo only a human can play&lt;/a&gt;, where the part that makes work meaningful is exactly the human care to get it right rather than merely done.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Something happened recently that made this very concrete for me.
I had done a code review on a colleague&amp;#8217;s work.
Within moments the whole review had been dropped straight into an AI, and the suggested changes came back to me almost at once, ready for another round.
Part of me thought that maybe this is simply the new way of working, and I have no wish to be the person who waves away a useful tool.
But another part of me wondered what quietly went missing in those few seconds.
The pause to sit with the feedback, to understand why the remark was made, and to let it change how you think next time.
If the review goes in one side and the fix comes out the other without anyone really learning from it, we may end up shipping something that passes while slowly losing the ability to reason about it ourselves.
I use AI every day and I believe in its value, so this is not a complaint about the tool.
It is an honest question about where the thinking, and the learning, still take place.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Failing on the way to good&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;There is a reason I keep coming back to Michael Jordan when I write about our work.
He put it better than I can:
&#34;I have missed more than nine thousand shots in my career. I have lost almost three hundred games. I have failed over and over and over again in my life. And that is why I succeed.&#34;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;imageblock text-center&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;/blog/uploads/2026/10/miss_mj.png&#34; alt=&#34;miss mj&#34; width=&#34;50%&#34;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;That is the mentality I would love to protect, in ourselves and in the people coming after us.
Not failure for its own sake, but failure as the normal price of trying to be good at something.
The score is not the enemy of growth, it is one of the things that makes growth possible.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;So what can we do with that, without becoming the grumbling older colleague nobody wants to sit next to?
For me it starts small and close to home.
Give feedback that is kind and clear at the same time, and do not water it down to spare someone’s feelings when they can handle more than we assume.
Let people experience a real result, including the disappointing kind, and then stand beside them while they make it better.
Acknowledge good work when it is genuinely good, so that the word still means something.
And keep some of your own attention for the room you are in, whether that is a team, a review, or a coffee shop.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I do not have this fully worked out, and I am wary of anyone who claims they do.
But I keep landing in the same place.
The score still matters, criticism is still a gift, and the special work still comes from people who are willing to fail on the way to getting it right.
That is worth holding on to, and I would rather keep reaching for it than quietly settle for the middle.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Software Engineering" scheme="https://jdriven.com/blog/category/Software-Engineering/" />
        <category term="Tech Culture" scheme="https://jdriven.com/blog/category/Software-Engineering/Tech-Culture/" />
        <category term="AI" scheme="https://jdriven.com/blog/tag/AI/" />
        <category term="Techradar" scheme="https://jdriven.com/blog/tag/Techradar/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/Hibernate-with-Business-Keys/</id>
        <title>Hibernate with Business Keys</title>
        <social:hashtags>#Database #ORM #Hibernate #SoftwareDevelopment #JPA #BusinessKeys</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/Hibernate-with-Business-Keys/"/>
        <published>2026-10-28T00:00:00.000Z</published>
        <updated>2026-10-28T00:00:00.000Z</updated>
        <author>
            <name>Ronald</name>
            <social:twitter>kqosh1</social:twitter>
            <uri>https://jdriven.com/blog/author/ronald-koster</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;A common practice with Hibernate is to give each entity an &lt;code&gt;id&lt;/code&gt; field to store its primary key.
This field is generally managed by Hibernate.
When the entity has not been saved yet, the field is &lt;code&gt;null&lt;/code&gt;, which is also how Hibernate detects the object has not been saved yet.
Once it is saved, Hibernate sets the value of the &lt;code&gt;id&lt;/code&gt; to the generated value.
Since the value of the &lt;code&gt;id&lt;/code&gt; field changes, it is not suited to base your &lt;code&gt;equals&lt;/code&gt; and &lt;code&gt;hashCode&lt;/code&gt; methods on.
Which is a bit counter-intuitive, because it corresponds to the primary key in the database.
The solution is to use Business Keys.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;A common practice with Hibernate is to give each entity an &lt;code&gt;id&lt;/code&gt; field to store its primary key.
This field is generally managed by Hibernate.
When the entity has not been saved yet, the field is &lt;code&gt;null&lt;/code&gt;, which is also how Hibernate detects the object has not been saved yet.
Once it is saved, Hibernate sets the value of the &lt;code&gt;id&lt;/code&gt; to the generated value.
Since the value of the &lt;code&gt;id&lt;/code&gt; field changes, it is not suited to base your &lt;code&gt;equals&lt;/code&gt; and &lt;code&gt;hashCode&lt;/code&gt; methods on.
Which is a bit counter-intuitive, because it corresponds to the primary key in the database.
The solution is to use Business Keys.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Data Model&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Suppose you have the following data model:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;imageblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;/blog/uploads/2024/12/Company-Employee.png&#34; alt=&#34;Company-Employee.png&#34; width=&#34;60%&#34;&gt;
&lt;/div&gt;
&lt;div class=&#34;title&#34;&gt;Figure 1. Data Model&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;With the following Java code:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;import jakarta.persistence.Column;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.MappedSuperclass;

@MappedSuperclass
public abstract class BaseEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = &#34;id&#34;, updatable = false, nullable = false)
    private Long id;

    public Long getId() {
        return id;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (obj == null || !(obj instanceof BaseEntity)) return false;
        BaseEntity other = (BaseEntity) obj;
        if (other.getId() == null) return false;
        return other.getId().equals(getId());
    }

    @Override
    public int hashCode() {
        return getId() != null ? getId().hashCode() : 0;
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.OneToMany;

@Entity
public class Company extends BaseEntity{

    @Column(name = &#34;name&#34;, length = 100, nullable = false)
    public String name;

    @OneToMany(mappedBy = &#34;company&#34;, cascade = CascadeType.ALL, orphanRemoval = true)
    public Set&amp;lt;Employee&amp;gt; employees;
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.ForeignKey;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;

@Entity
public class Employee extends BaseEntity {

    @Column(name = &#34;first_name&#34;, length = 100, nullable = false)
    public String firstName;

    @Column(name = &#34;last_name&#34;, length = 100, nullable = false)
    public String lastName;

    @Column(name = &#34;email&#34;, length = 100, nullable = false)
    public String email;

    @ManyToOne
    @JoinColumn(foreignKey = @ForeignKey(name = &#34;fk_employee_company&#34;))
    public Company company;
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The Problem&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;This code can give weird problems.
Suppose you have a &lt;code&gt;company&lt;/code&gt; object of type &lt;code&gt;Company&lt;/code&gt;, and you add a new &lt;code&gt;Employee&lt;/code&gt; object to &lt;code&gt;company.employees&lt;/code&gt;.
Since the new object, &lt;code&gt;employee&lt;/code&gt;, is new &lt;code&gt;employee.id == null&lt;/code&gt;.
Next you save the &lt;code&gt;company&lt;/code&gt; and the new &lt;code&gt;Employee&lt;/code&gt; object.
Its &lt;code&gt;id&lt;/code&gt; now gets a value from Hibernate.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;&lt;strong&gt;However&lt;/strong&gt;, &lt;code&gt;employee&lt;/code&gt; was already added to the set &lt;code&gt;company.employees&lt;/code&gt; with a different &lt;code&gt;id&lt;/code&gt;.
But &lt;code&gt;hashCode&lt;/code&gt; and &lt;code&gt;equals&lt;/code&gt; now yield different values.
As a result Java/Hibernate may not be able to find the corresponding object in the set anymore.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;This is why it is impossible to create a consistent &lt;code&gt;hashCode&lt;/code&gt; and &lt;code&gt;equals&lt;/code&gt; method based upon &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The Solution&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Fortunately there is a solution that does give consistent behavior both in your code and the database, by using Business Keys.
Refactor &lt;code&gt;BaseEntity&lt;/code&gt; like this:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;import jakarta.persistence.Column;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.MappedSuperclass;

@MappedSuperclass
public abstract class BaseEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = &#34;id&#34;, updatable = false, nullable = false)
    private Long id;

    // Immutable ID, set upon &#39;new&#39;, independent from DB
    @Column(name = &#34;business_key&#34;, nullable = false, unique = true, updatable = false)
    private String businessKey = UUID.randomUUID().toString();

    public Long getId() {
        return id;
    }

    public String getBusinessKey() {
        return businessKey;
    }

    @Override
    public final boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null || !(obj instanceof BaseEntity)) return false;
        BaseEntity other = (BaseEntity) obj;
        return Objects.equals(this.getBusinessKey(), other.getBusinessKey());
    }

    @Override
    public final int hashCode() {
        return Objects.hashCode(getBusinessKey());
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;With this code the value of the Business Key is always the same both for unsaved and saved entities,
and its value in the code is always consistent with that in the database.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Therefore, it is recommended to always use business keys to avoid inconsistent (difficult-to-debug) behavior.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Software Development" scheme="https://jdriven.com/blog/category/Software-Development/" />
        <category term="Database" scheme="https://jdriven.com/blog/category/Software-Development/Database/" />
        <category term="JPA" scheme="https://jdriven.com/blog/category/Software-Development/Database/JPA/" />
        <category term="Hibernate" scheme="https://jdriven.com/blog/category/Software-Development/Database/JPA/Hibernate/" />
        <category term="ORM" scheme="https://jdriven.com/blog/category/Software-Development/Database/JPA/Hibernate/ORM/" />
        <category term="Business Keys" scheme="https://jdriven.com/blog/category/Software-Development/Database/JPA/Hibernate/ORM/Business-Keys/" />
        <category term="Database" scheme="https://jdriven.com/blog/tag/Database/" />
        <category term="ORM" scheme="https://jdriven.com/blog/tag/ORM/" />
        <category term="Hibernate" scheme="https://jdriven.com/blog/tag/Hibernate/" />
        <category term="Software Development" scheme="https://jdriven.com/blog/tag/Software-Development/" />
        <category term="JPA" scheme="https://jdriven.com/blog/tag/JPA/" />
        <category term="Business Keys" scheme="https://jdriven.com/blog/tag/Business-Keys/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/Datetime-formats-and-types-in-APIs-and-databases/</id>
        <title>Datetime formats and types in APIs and databases</title>
        <social:hashtags>#API #JSON #Database #Jackson #ORM #Hibernate #SoftwareDevelopment</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/Datetime-formats-and-types-in-APIs-and-databases/"/>
        <published>2026-10-27T00:30:00.000Z</published>
        <updated>2026-10-27T00:30:00.000Z</updated>
        <author>
            <name>Ronald</name>
            <social:twitter>kqosh1</social:twitter>
            <uri>https://jdriven.com/blog/author/ronald-koster</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;How to represent datetimes in APIs, the code, and the database is always tricky. Most people I have worked with struggled with this.
The main mistake is omitting the time zone based on the false assumption that defaults are uniform across systems. They are not.
As a result timestamps carried across systems get weird time jumps.
This blog gives some rules to avoid these mistakes and gives a clean set up.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;How to represent datetimes in APIs, the code, and the database is always tricky. Most people I have worked with struggled with this.
The main mistake is omitting the time zone based on the false assumption that defaults are uniform across systems. They are not.
As a result timestamps carried across systems get weird time jumps.
This blog gives some rules to avoid these mistakes and gives a clean set up.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Counting the Time Zones&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;First of all people tend to forget how many systems and accompanying (default) time zones a typical configuration has.
Suppose you have a:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;browser on the user&amp;#8217;s computer, running a single page application&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;server application with a REST API, running in a docker container&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;database, running in a docker container&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Counting the (default) time zones settings:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;browser computer: 1 (usually local time)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;server container: 1 (default UTC, usually UTC or local time)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;database container: 1 (default UTC, usually UTC)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;database time zone setting: 1 (usually UTC or local time)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;To complicate matters we also have daylight saving time.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Dropping the time zone from your timestamps and assuming the other system has the same default time zone is therefore very unreliable.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Preferred Configuration&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;My preferred configuration would be:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;browser: local time&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;all other systems: UTC (by using UTC you avoid daylight saving time jumps)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;But the following example should work for any time zone mix.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;To keep the datetime format intact everywhere we should, assuming we have a Spring Boot application, use the following configuration.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;sect3&#34;&gt;
&lt;h4&gt;Database&lt;/h4&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Use datetime field types with time zone.
For example in PostreSQL you can use &lt;code&gt;TIMESTAMPTZ&lt;/code&gt; (with time zone) instead of &lt;code&gt;TIMESTAMP&lt;/code&gt; (no time zone).
However, if you do use time zone-less timestamps the following approach still works.
Furthermore set the following properties in your &lt;code&gt;application.yml&lt;/code&gt; (NB Is crucial when you use time zone less timestamps!):&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-yaml hljs&#34; data-lang=&#34;yaml&#34;&gt;spring:
  jpa:
    properties:
      hibernate:
        jdbc:
          time_zone: UTC&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;This settings will ensure that the correct conversion of datetime fields to/from the database even if you use a database field type that does not store the time zone.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect3&#34;&gt;
&lt;h4&gt;Java Code&lt;/h4&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In the code you should use &lt;code&gt;Instant&lt;/code&gt; for all datetime fields (has a fixed time zone: UTC). &lt;code&gt;ZonedDateTime&lt;/code&gt; is also an option but less convenient.
Do &lt;strong&gt;not&lt;/strong&gt; use &lt;code&gt;LocalDateTime&lt;/code&gt;, because that has no the time zone.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;import jakarta.persistence.Column;
import jakarta.persistence.MappedSuperclass;
import jakarta.persistence.PrePersist;
import jakarta.persistence.PreUpdate;
import org.hibernate.annotations.ColumnDefault;

import java.time.Instant;

@MappedSuperclass
public abstract class BaseEntity {

    @ColumnDefault(&#34;CURRENT_TIMESTAMP&#34;)
    @Column(name = &#34;created_at&#34;, nullable = false, updatable = false)
    private Instant createdAt;

    @ColumnDefault(&#34;CURRENT_TIMESTAMP&#34;)
    @Column(name = &#34;updated_at&#34;, nullable = false)
    private Instant updatedAt;

    @PrePersist
    public void setCreatedAt() {
        var now = Instant.now();
        createdAt = now;
        updatedAt = now;
    }

    @PreUpdate
    public void setUpdatedAt() {
        updatedAt = Instant.now();
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect3&#34;&gt;
&lt;h4&gt;API&lt;/h4&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In the API prefer the ISO-8601 format. By using &lt;code&gt;Instant&lt;/code&gt; in your code all you need is the following settings in &lt;code&gt;application.yml&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-yaml hljs&#34; data-lang=&#34;yaml&#34;&gt;spring:
  jackson:
    time-zone: UTC&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Since Jackon 3 this is all you need to configure to write/read ISO-8601 formatted datetimes in your API.
It will use nanosecond precision, but ISO-8601 removes trailing zero. So a typical timestamp could look like: &lt;code&gt;&#34;2026-10-02T07:26:26.123456Z&#34;&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Software Development" scheme="https://jdriven.com/blog/category/Software-Development/" />
        <category term="Database" scheme="https://jdriven.com/blog/category/Software-Development/Database/" />
        <category term="API" scheme="https://jdriven.com/blog/category/Software-Development/Database/API/" />
        <category term="JSON" scheme="https://jdriven.com/blog/category/Software-Development/Database/API/JSON/" />
        <category term="ORM" scheme="https://jdriven.com/blog/category/Software-Development/Database/API/JSON/ORM/" />
        <category term="Hibernate" scheme="https://jdriven.com/blog/category/Software-Development/Database/API/JSON/ORM/Hibernate/" />
        <category term="Jackson" scheme="https://jdriven.com/blog/category/Software-Development/Database/API/JSON/ORM/Hibernate/Jackson/" />
        <category term="API" scheme="https://jdriven.com/blog/tag/API/" />
        <category term="JSON" scheme="https://jdriven.com/blog/tag/JSON/" />
        <category term="Database" scheme="https://jdriven.com/blog/tag/Database/" />
        <category term="Jackson" scheme="https://jdriven.com/blog/tag/Jackson/" />
        <category term="ORM" scheme="https://jdriven.com/blog/tag/ORM/" />
        <category term="Hibernate" scheme="https://jdriven.com/blog/tag/Hibernate/" />
        <category term="Software Development" scheme="https://jdriven.com/blog/tag/Software-Development/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/Null-Safer-Java-With-NullAway/</id>
        <title>Null Safe(r) Java with NullAway</title>
        <social:hashtags>#Java #Compiler #NullAway</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/Null-Safer-Java-With-NullAway/"/>
        <published>2026-10-26T11:00:00.000Z</published>
        <updated>2026-10-26T11:00:00.000Z</updated>
        <author>
            <name>Jorrit</name>
            <uri>https://jdriven.com/blog/author/jorritvanderven</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;After working on Kotlin projects for over seven years, I recently started on a Java project again.
One of the things I missed most was the fact that Kotlin explicitly supports nullability as part of its type system. Within the first day I ran into a &lt;code&gt;NullPointerException&lt;/code&gt;.
Luckily, we can now add compile-time null checks to Java as well, making Java null safe(r)!&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;After working on Kotlin projects for over seven years, I recently started on a Java project again.
One of the things I missed most was the fact that Kotlin explicitly supports nullability as part of its type system. Within the first day I ran into a &lt;code&gt;NullPointerException&lt;/code&gt;.
Luckily, we can now add compile-time null checks to Java as well, making Java null safe(r)!&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;How does it work?&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/uber/nullaway&#34;&gt;NullAway&lt;/a&gt; is a plugin for the Java compiler which checks that method return values and method parameters that are not explicitly declared nullable, are in fact not null.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;For example, given this code snippet:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package com.jdriven.blog.nullaway;

public class NullTest {
    public static String foo() {
        return null;
    }

    public static void printMessage(String msg) {
        IO.println(msg.toString());
    }

    static void main() {
        printMessage(foo());
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;This will compile just fine, but will throw an NPE when run. Ideally we want the compiler to verify that &lt;code&gt;foo()&lt;/code&gt; returns &lt;code&gt;null&lt;/code&gt;, and &lt;code&gt;printMessage&lt;/code&gt; expects the &lt;code&gt;msg&lt;/code&gt; String to be non-null. Using NullAway we can do just that!&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Adding the NullAway compiler plugin to your project&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In this example I&amp;#8217;ll use Maven. Let&amp;#8217;s add NullAway to our &lt;code&gt;pom.xml&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-xml hljs&#34; data-lang=&#34;xml&#34;&gt;&amp;lt;project&amp;gt;
    &amp;lt;properties&amp;gt;
        &amp;lt;jspecify.version&amp;gt;1.0.1&amp;lt;/jspecify.version&amp;gt;
        &amp;lt;nullability.plugin.version&amp;gt;0.5.2&amp;lt;/nullability.plugin.version&amp;gt;
    &amp;lt;/properties&amp;gt;

    &amp;lt;dependencies&amp;gt;
        &amp;lt;!-- provides annotations for used by NullAway --&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.jspecify&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;jspecify&amp;lt;/artifactId&amp;gt;
            &amp;lt;version&amp;gt;1.0.1&amp;lt;/version&amp;gt;
        &amp;lt;/dependency&amp;gt;
    &amp;lt;/dependencies&amp;gt;

    &amp;lt;build&amp;gt;
        &amp;lt;plugins&amp;gt;
            &amp;lt;plugin&amp;gt;
                &amp;lt;!-- Configures the ErrorProne and NullAway plugins --&amp;gt;
                &amp;lt;groupId&amp;gt;am.ik.maven&amp;lt;/groupId&amp;gt;
                &amp;lt;artifactId&amp;gt;nullability-maven-plugin&amp;lt;/artifactId&amp;gt;
                &amp;lt;version&amp;gt;${nullability.plugin.version}&amp;lt;/version&amp;gt;
                &amp;lt;extensions&amp;gt;true&amp;lt;/extensions&amp;gt;
                &amp;lt;executions&amp;gt;
                    &amp;lt;execution&amp;gt;
                        &amp;lt;goals&amp;gt;
                            &amp;lt;goal&amp;gt;configure&amp;lt;/goal&amp;gt;
                            &amp;lt;goal&amp;gt;generate-package-info&amp;lt;/goal&amp;gt;
                        &amp;lt;/goals&amp;gt;
                    &amp;lt;/execution&amp;gt;
                &amp;lt;/executions&amp;gt;
            &amp;lt;/plugin&amp;gt;
		&amp;lt;/plugins&amp;gt;
	&amp;lt;/build&amp;gt;
&amp;lt;/project&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;NullAway needs the ErrorProne compiler plugin and about 40 lines of configuration in your POM file. Luckily, there is the &lt;a href=&#34;https://github.com/making/nullability-maven-plugin&#34;&gt;nullability-maven-plugin&lt;/a&gt; which does this for you.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Now we can start using NullAway in our project!&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Add JSpecify annotations to the code&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Of course, the NullAway plugin needs to know if a method is allowed to return or receive a null value.
To do this, we first need to tell NullAway that the code in our package is annotated with JSpecify annotations. This can be done by either annotating a class with &lt;code&gt;@NullMarked&lt;/code&gt;, or by added the &lt;code&gt;@NullMarked&lt;/code&gt; annotation to the &lt;code&gt;package-info.java&lt;/code&gt; file:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;@NullMarked
package com.jdriven.blog.nullaway;

import org.jspecify.annotations.NullMarked;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Next, we can start annotating our example code:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package com.jdriven.blog.nullaway;

import org.jspecify.annotations.Nullable;

public class NullTest {
    public static @Nullable String foo() {
        return null;
    }

    public static void printMessage(@Nullable String msg) {
        IO.println(msg.toString());
    }

    static void main() {
        printMessage(foo());
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;When we now try to compile the project, compilation will fail with the following error:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-none hljs&#34;&gt;[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.15.0:compile (default-compile) on project blog-nullaway: Compilation failure
[ERROR] src/main/java/com/jdriven/blog/nullaway/NullTest.java:[11,22] [NullAway] dereferenced expression &#39;msg&#39; is @Nullable&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Now, when we fix the bug in our application, compilation will succeed! The compiler just saved us from an NPE on production!🎉&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;public static void printMessage(@Nullable String msg) {
    if (msg != null) {
        IO.println(msg.toString());
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Nullable entries in collections&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;NullAway even supports null checks in Java collections! For example, if we want a method to return a &lt;code&gt;List&lt;/code&gt; of `String`s, where some
of the values might be null, we can annotate the type argument of a list:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;public static List&amp;lt;@Nullable String&amp;gt; getStrings() {
    return List.of(&#34;foo&#34;, null, &#34;bar&#34;);
}

public static void processStrings(List&amp;lt;@Nullable String&amp;gt; strings) {
    strings.stream()
        .filter(Objects::nonNull)
        .forEach(e -&amp;gt; IO.println(e.trim()));
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;If we would remove (or forget 😬) the &lt;code&gt;@Nullable&lt;/code&gt; annotation on the &lt;code&gt;String&lt;/code&gt; type argument in &lt;code&gt;processStrings()&lt;/code&gt;, compilation would fail with the following error:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-none hljs&#34;&gt;[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.15.0:compile (default-compile) on project blog-nullaway: Compilation failure
[ERROR] /src/main/java/com/jdriven/blog/nullaway/Lists.java:[27,45] [NullAway] incompatible types: List&amp;lt;String&amp;gt; cannot be converted to List&amp;lt;@Nullable String&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The compiler now makes sure that we cannot pass a list with possible null values into a method which does not support this!&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Framework support&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Spring Boot 4 and most sub-projects have their API&amp;#8217;s fully annotated with JSpecify annotations!, so you&amp;#8217;ll never have to guess if a value might be null or not.
Since Kotlin also uses JSpecify annotations for interopability with their type system, more and more projects are annotated with JSpecify.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;NullAway is a great tool to reduce bugs in your code that could have easily been prevented.
I think it&amp;#8217;s a no-brainer for all (new) projects where Kotlin isn&amp;#8217;t an option.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The source code for the examples is available on &lt;a href=&#34;https://github.com/jorritvdven/jdriven-blog-nullaway&#34;&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Java" scheme="https://jdriven.com/blog/category/Java/" />
        <category term="Java" scheme="https://jdriven.com/blog/tag/Java/" />
        <category term="Compiler" scheme="https://jdriven.com/blog/tag/Compiler/" />
        <category term="NullAway" scheme="https://jdriven.com/blog/tag/NullAway/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/Did-I-Map-Everything/</id>
        <title>Did I Map Everything?</title>
        <social:hashtags>#Mockito #JDBC #UnitTesting #DataMigration</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/Did-I-Map-Everything/"/>
        <published>2026-10-23T05:00:00.000Z</published>
        <updated>2026-10-23T05:00:00.000Z</updated>
        <author>
            <name>Tundzaj Barov</name>
            <uri>https://jdriven.com/blog/author/tundzaj-barov</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;When migrating database schemas, you rarely get clean, predictable data. Legacy databases often have cryptic column names, partially backfilled fields, nullable values, or columns that are completely empty.
That’s why you write custom Java JDBC mappers in the first place: to explicitly control how legacy database columns map to your target Java objects, rather than relying on automatic mapping that may not handle these inconsistencies correctly.
But there’s a catch: standard unit tests can pass even when you completely forget to map a field. Because null == null, a missing mapping line looks identical to a column that is legitimately empty in your database.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;When migrating database schemas, you rarely get clean, predictable data. Legacy databases often have cryptic column names, partially backfilled fields, nullable values, or columns that are completely empty.
That’s why you write custom Java JDBC mappers in the first place: to explicitly control how legacy database columns map to your target Java objects, rather than relying on automatic mapping that may not handle these inconsistencies correctly.
But there’s a catch: standard unit tests can pass even when you completely forget to map a field. Because null == null, a missing mapping line looks identical to a column that is legitimately empty in your database.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Here’s a simple reflection trick to verify that your custom mapper covers 100% of your target Java class, so missing mappings don’t slip through unnoticed.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The Trap&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Imagine your clean target Java class looks like this:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package com.example;

import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class User {
    private Long id;
    private String fullName;
    private String emailAddress;
    private String migrationRefCode; // Can be NULL in DB during migration
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Your custom mapper looks like this (notice that the &lt;code&gt;MIG_REF_CD&lt;/code&gt; mapping is commented out):&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package com.example;

import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

public class UserMapper implements RowMapper&amp;lt;User&amp;gt; {

    @Override
    public User mapRow(ResultSet rs, int rowNum) throws SQLException {
        User user = new User();
        long id = rs.getLong(&#34;USR_ID&#34;);
        user.setId(rs.wasNull() ? null : id);
        user.setFullName(rs.getString(&#34;FULL_NM&#34;));
        user.setEmailAddress(rs.getString(&#34;EMAIL_ADDR&#34;));
        // Forgot: user.setMigrationRefCode(rs.getString(&#34;MIG_REF_CD&#34;));
        return user;
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;If you write a standard unit test where &lt;code&gt;MIG_REF_CD&lt;/code&gt; is stubbed as null (or left unstubbed), your test passes with flying colors. The test expects &lt;code&gt;migrationRefCode&lt;/code&gt; to be null, it is null, and the missing line of code goes totally undetected until production.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The Solution: Fake 100% Data in Your Unit Test&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Don&amp;#8217;t use a real database connection for this test. Instead, mock the &lt;code&gt;ResultSet&lt;/code&gt; so it guarantees non-null fake data for every single getter call, regardless of whether the real database column is nullable or not.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;sect3&#34;&gt;
&lt;h4&gt;The Reflection Helper&lt;/h4&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;To verify that no fields were skipped, create a simple test utility using standard Java Reflection to inspect every declared field on the object:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package com.example.util;

import java.lang.reflect.Field;

import static org.junit.jupiter.api.Assertions.assertNotNull;

public class MapperTestUtils {
    public static void assertAllFieldsMapped(Object target) {
        assertNotNull(target, &#34;Target mapped object cannot be null!&#34;);

        Class&amp;lt;?&amp;gt; clazz = target.getClass();

        for (Field field : clazz.getDeclaredFields()) {
            field.setAccessible(true);
            try {
                Object value = field.get(target);
                assertNotNull(
                        value,
                        &#34;You forgot to map field: &#39;&#34; + field.getName() + &#34;&#39; in &#34; + clazz.getSimpleName() + &#34;!&#34;
                );
            } catch (IllegalAccessException e) {
                throw new RuntimeException(&#34;Failed to access field: &#34; + field.getName(), e);
            }
        }
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The Complete Test Code&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Now, stub your &lt;code&gt;ResultSet&lt;/code&gt; to return fake values for every field, map the row, and invoke &lt;code&gt;assertAllFieldsMapped(user)&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package com.example;

import org.junit.jupiter.api.Test;

import java.sql.ResultSet;
import java.sql.SQLException;

import static com.example.util.MapperTestUtils.assertAllFieldsMapped;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class UserMapperTest {

    @Test
    void verifyMappedValuesMatchFakeData() throws SQLException {
        ResultSet rs = mock(ResultSet.class);
        when(rs.getString(anyString())).thenReturn(&#34;FAKE_DATA&#34;);
        when(rs.getLong(anyString())).thenReturn(100L);

        UserMapper mapper = new UserMapper();
        User user = mapper.mapRow(rs, 1);

        assertEquals(100L, user.getId());
        assertEquals(&#34;FAKE_DATA&#34;, user.getFullName());
        assertEquals(&#34;FAKE_DATA&#34;, user.getEmailAddress());
    }

    @Test
    void ensureEveryJavaFieldIsMapped() throws SQLException {
        ResultSet rs = mock(ResultSet.class);
        when(rs.getString(anyString())).thenReturn(&#34;FAKE_DATA&#34;);
        when(rs.getLong(anyString())).thenReturn(100L);

        UserMapper mapper = new UserMapper();
        User user = mapper.mapRow(rs, 1);

        assertEquals(100L, user.getId());
        assertEquals(&#34;FAKE_DATA&#34;, user.getFullName());
        assertEquals(&#34;FAKE_DATA&#34;, user.getEmailAddress());

        assertAllFieldsMapped(user);
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Test Execution Results&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;When you run both tests against the incomplete &lt;code&gt;UserMapper&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;olist arabic&#34;&gt;
&lt;ol class=&#34;arabic&#34;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;verifyMappedValuesMatchFakeData()&lt;/code&gt; PASSED:&lt;/strong&gt; This traditional test only asserts the fields you explicitly check. Because it doesn&amp;#8217;t inspect &lt;code&gt;migrationRefCode&lt;/code&gt;, it green-lights a broken mapper.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ensureEveryJavaFieldIsMapped()&lt;/code&gt; FAILED:&lt;/strong&gt; This test invokes &lt;code&gt;assertAllFieldsMapped(user)&lt;/code&gt; and fails instantly with an actionable assertion error:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Silent mapping omissions are one of the most frustrating sources of post-migration bugs because standard unit tests let them slip right through. By pairing non-null Mockito stubs with a reflection-based field check, you establish an automated fail-fast safety net across your entire data access layer. Incorporating this quick utility into your test pipeline guarantees 100% field mapping coverage, helps catch missing mappings early.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Java" scheme="https://jdriven.com/blog/category/Java/" />
        <category term="Testing" scheme="https://jdriven.com/blog/category/Java/Testing/" />
        <category term="Mockito" scheme="https://jdriven.com/blog/tag/Mockito/" />
        <category term="JDBC" scheme="https://jdriven.com/blog/tag/JDBC/" />
        <category term="Unit Testing" scheme="https://jdriven.com/blog/tag/Unit-Testing/" />
        <category term="Data Migration" scheme="https://jdriven.com/blog/tag/Data-Migration/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/Nushell-Niceties-Finding-Same-Elements-In-Lists-Or-Tables/</id>
        <title>Nushell Niceties: Finding Same Elements In Lists Or Tables</title>
        <social:hashtags>#Nushell</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/Nushell-Niceties-Finding-Same-Elements-In-Lists-Or-Tables/"/>
        <published>2026-10-22T07:03:11.000Z</published>
        <updated>2026-10-22T07:03:11.000Z</updated>
        <author>
            <name>mrhaki</name>
            <social:mastodon>mrhaki@mastodon.online</social:mastodon>
            <social:bluesky>mrhaki.com</social:bluesky>
            <uri>https://jdriven.com/blog/author/mrhaki</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The &lt;code&gt;intersect&lt;/code&gt; command can be used on lists and tables to find the same elements that are in the input list or table and a provided list or table.
The input is passed to the command and the other list or table is an argument for the &lt;code&gt;intersect&lt;/code&gt; command.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The &lt;code&gt;intersect&lt;/code&gt; command can be used on lists and tables to find the same elements that are in the input list or table and a provided list or table.
The input is passed to the command and the other list or table is an argument for the &lt;code&gt;intersect&lt;/code&gt; command.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The following examples shows usages of the &lt;code&gt;intersect&lt;/code&gt; command:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-plain hljs&#34; data-lang=&#34;plain&#34;&gt;use std/assert

# intersect return a new list with all elements found in
# the input list and the other list.
assert equal ([1 2 3 4 5] | intersect [2 4 6 8]) [2 4]

# An empty list is returned when no element is
# in both lists
assert equal ([a b c] | intersect [d e f]) []


# intersect can be used with tables as well
(assert equal
  ([[lower upper]; [a A] [b B] [c C]] | intersect [[lower upper]; [c C] [d D]])
  [[lower upper]; [c C]])
(assert equal
  ([{a: A} {b: B} {c: C}] | intersect [{c: C} {d: D}])
  [{c: C}])

(assert equal
  ([[lower upper]; [a A] [b B] [c C]] | intersect [[lower upper]; [d D] [e E]])
  [])&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Written with Nushell 0.114.1.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;&lt;a href=&#34;https://blog.mrhaki.com/2026/07/nushell-niceties-finding-same-elements.html&#34;&gt;Original post&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;</content>
        <category term="Nushell" scheme="https://jdriven.com/blog/category/Nushell/" />
        <category term="Nushell" scheme="https://jdriven.com/blog/tag/Nushell/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/pondering/</id>
        <title>Pondering AI - and AIthics</title>
        <social:hashtags>#ai #llm #softwaredevelopment</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/pondering/"/>
        <published>2026-10-21T06:00:00.000Z</published>
        <updated>2026-10-21T06:00:00.000Z</updated>
        <author>
            <name>Justus</name>
            <uri>https://jdriven.com/blog/author/jbrugman</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;There is no shortage of discussion about AI, and LLMs in particular.
This is my personal take on the debate: the claims I question, the concerns I share, and the questions I am still working through.
Wild claims abound, from “Soon, we won’t need developers anymore” and “AI is taking over the world” to “LLMs are a dead end,” “LLMs are bad for the environment,” “LLMs commit plagiarism,” and “LLMs are unethical.”
And the list goes on.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;There is no shortage of discussion about AI, and LLMs in particular.
This is my personal take on the debate: the claims I question, the concerns I share, and the questions I am still working through.
Wild claims abound, from “Soon, we won’t need developers anymore” and “AI is taking over the world” to “LLMs are a dead end,” “LLMs are bad for the environment,” “LLMs commit plagiarism,” and “LLMs are unethical.”
And the list goes on.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Most of these comments are clickbait: wildly exaggerated claims designed to get people to read an article, watch a YouTube video, or click a link.
But I also come across sincere opinions that make me wonder whether we really need to turn the volume up quite so high.
Many of these claims raise valid questions, but the issues behind them are often far more nuanced.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;But first: whether you like it or not, AI is here to stay.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;We have quickly grown used to having a helpful assistant handle tricky little tasks and patiently answer whatever questions we throw at it.
We have even started referring to its incorrect answers as “hallucinations”, seemingly overlooking how, for an LLM, correct and incorrect answers arise from the same generative process.
And I see more and more people turning to their trusted companions Claude and ChatGPT for answers.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;LLMs commit plagiarism and are trained on “stolen” code and texts&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Understanding how models are trained and generate their output helps us distinguish between training on existing work, reproducing it, and committing plagiarism.
There are still legitimate questions about consent, copyright, and compensation.
There is a difference between a model &lt;strong&gt;reproducing&lt;/strong&gt; an existing text and one drawing on patterns learned from millions of texts to compose a new answer.
With code, things get even more interesting.
After all, developers also use existing solutions, libraries, documentation, examples, and code written by others.
Of course, we cannot simply copy everything.
Licences and copyright still matter.
But we generally see nothing strange about developers learning from other people&amp;#8217;s code.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Rather than asking whether AI “steals”, perhaps we should ask where to draw the line.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Which data may be used to train a model?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When is permission required?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;What happens if a model reproduces protected material?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;How do we make sure creators are not simply left footing the bill for someone else’s progress?&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Many companies use open-source projects or libraries to build commercial products while keeping their own source code private.
And that is not automatically wrong.
Open-source licences differ in what they allow and what they require.
Some licences permit commercial use without requiring derivative software to be made public.
Others impose additional conditions.
But it does raise an interesting question:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;admonitionblock note&#34;&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td class=&#34;icon&#34;&gt;
&lt;i class=&#34;fa icon-note&#34; title=&#34;Note&#34;&gt;&lt;/i&gt;
&lt;/td&gt;
&lt;td class=&#34;content&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Why do we assume AI’s use of other people’s work is inherently problematic, given the software world has spent years debating similar tensions between open sharing, commercial use, and creators’ rights?&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;AI is unethical&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;This may be one of the trickiest points, because people often lump several different debates together.
An outspoken critic—or supporter—can bring up privacy, copyright, concentration of power, misinformation, environmental impact, and the effects on employment all in one breath.
I think it is more helpful to address those issues separately.
I would expect different safeguards for an AI application handling medical information than for one helping me write a regex or recreate Grandma’s apple pie.
Still, we should not overlook the ethical questions AI raises.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Is there enough transparency about how AI models are trained and what data is used?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;How do we protect individuals’ privacy when using AI?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;How can we make sure AI systems are fair and do not unintentionally disadvantage particular groups?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;How will AI affect employment and the way our society is organised?&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;These are questions we need to take seriously.
They call for clear agreements and, where necessary, guidelines and regulation.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;admonitionblock note&#34;&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td class=&#34;icon&#34;&gt;
&lt;i class=&#34;fa icon-note&#34; title=&#34;Note&#34;&gt;&lt;/i&gt;
&lt;/td&gt;
&lt;td class=&#34;content&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;AI clearly raises ethical questions.
But AI as a whole is not necessarily unethical.
Its ethical implications depend, among other things, on how a system is developed, what it is used for, and which safeguards are in place.
The more useful question may be under what conditions we can use AI responsibly.&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;AI is bad for the environment&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Training large AI models requires a lot of energy.
Using those models also consumes energy.
And those energy costs come on top of hardware manufacturing, data centre construction, and any water needed for cooling.
But context matters here as well.
A trained model can then be used millions of times.
We should therefore consider the energy needed for training alongside the energy consumed over the model’s lifetime.
Running a model can consume substantial amounts of energy in its own right, especially at scale.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Fortunately, work is also being done on more efficient models and hardware.
Not every application needs the largest model available, and using smaller or specialised models can sometimes produce substantial savings.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;But how much difference does that actually make?
We need to look at the bigger picture.
Data centres, cloud computing, and other digital services also consume energy.
AI is therefore not the only technology drawing on our energy supply.
The additional demand from AI still deserves attention and may be substantial.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Still, modern data centres and cloud providers are increasingly using renewable energy sources.
Research into better algorithms and hardware also aims to make AI models more energy-efficient.
Reusing existing models can also help reduce energy consumption.
If an existing model meets an application’s needs, training a new one from scratch may be unnecessary.
This is where access to model weights matters.
Several large AI models are available as open-weight models, allowing others to run, adapt, or further train them.
This can encourage reuse and prevent unnecessary duplication of effort.
Not every model is fully open-source, of course, and running, adapting, or further training existing models still consumes energy.
Still, making model weights available could help us use resources more efficiently.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;An older model is not necessarily worse than a newer one, either.
If it is good enough for your intended application, why automatically choose the newest and largest model?
Techniques such as retrieval-augmented generation (RAG) can also give an existing model access to current or domain-specific information without retraining.
This can keep an older model useful for longer in certain applications.
Of course, RAG does not make every model equally suitable for every task.
It provides access to information from outside the model; it does not automatically overcome limitations in reasoning or other capabilities.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;admonitionblock note&#34;&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td class=&#34;icon&#34;&gt;
&lt;i class=&#34;fa icon-note&#34; title=&#34;Note&#34;&gt;&lt;/i&gt;
&lt;/td&gt;
&lt;td class=&#34;content&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Training and running AI models undeniably consumes energy.
But this alone does not make every application of AI bad for the environment.
Perhaps we should be asking different questions:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;How can we develop and use AI in ways that minimise energy consumption?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When is a smaller or older model sufficient?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;What value does a model provide in return for the energy and other resources it consumes during training and use?&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Ultimately, it is not just about how much energy AI consumes, but also about how efficiently we use that energy and what we use the technology for.&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;AI is taking over the world&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The idea of AI taking over the world is a popular theme in clickbait articles and films.
It conjures up images of a dystopian future in which AI rules over humanity.
But reality is rather more nuanced.
AI is a technology developed and deployed by people.
Today’s AI systems do not need human-like will or consciousness to be useful—or to pose risks.
Even without the ability to make independent decisions about their own goals, these systems can take on an increasing number of tasks and influence decisions that were once made by humans.
As those systems become more powerful and are deployed more widely, their potential impact grows.
Perhaps we should ask how much influence we are willing to give AI over society—and how much control we want to keep.
Ultimately, people decide how AI is developed, who has access to it, and what the technology is used for.
This makes our responsibility all the greater: AI’s power demands careful thought about the limits we set and the control we want to retain.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;admonitionblock note&#34;&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td class=&#34;icon&#34;&gt;
&lt;i class=&#34;fa icon-note&#34; title=&#34;Note&#34;&gt;&lt;/i&gt;
&lt;/td&gt;
&lt;td class=&#34;content&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;We once built an atomic bomb without fully reassuring everyone we wouldn’t accidentally set the atmosphere on fire.
Later, we built a particle accelerator, and people worried that we might create a black hole.
And now we are building AI.
Apparently, humans are an optimistic species: if something seems technically possible, we want to give it a go, even if we have not quite finished answering the question, “What could possibly go wrong?”
Perhaps we should ask AI itself:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;&lt;em&gt;User: “Be honest: are you planning to take over the world?”&lt;br&gt;
AI: “No, of course not.”&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;And with that reassuring answer, we can get back to work!&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="ai" scheme="https://jdriven.com/blog/category/ai/" />
        <category term="llm" scheme="https://jdriven.com/blog/category/ai/llm/" />
        <category term="software development" scheme="https://jdriven.com/blog/category/ai/llm/software-development/" />
        <category term="ai" scheme="https://jdriven.com/blog/tag/ai/" />
        <category term="llm" scheme="https://jdriven.com/blog/tag/llm/" />
        <category term="software development" scheme="https://jdriven.com/blog/tag/software-development/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/Nushell-Niceties-Parsing-JWT/</id>
        <title>Nushell Niceties: Parsing JWT</title>
        <social:hashtags>#JWT #Nushell #CLI</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/Nushell-Niceties-Parsing-JWT/"/>
        <published>2026-10-20T07:58:59.000Z</published>
        <updated>2026-10-20T07:58:59.000Z</updated>
        <author>
            <name>mrhaki</name>
            <social:mastodon>mrhaki@mastodon.online</social:mastodon>
            <social:bluesky>mrhaki.com</social:bluesky>
            <uri>https://jdriven.com/blog/author/mrhaki</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The &lt;a href=&#34;https://dev.karltryggvason.com/jwt-wrangling-in-your-terminal/&#34;&gt;following blog post by Karl Tryggvason&lt;/a&gt; shows a simple script to get data from a JSON Web Token (JWT) using &lt;code&gt;jq&lt;/code&gt;.
It is basically splitting the token on the &lt;code&gt;.&lt;/code&gt; and then convert each part from base64 encoding.
As extra functionality the timestamp fields &lt;code&gt;exp&lt;/code&gt; and &lt;code&gt;iat&lt;/code&gt; are converted to human readable dates.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The &lt;a href=&#34;https://dev.karltryggvason.com/jwt-wrangling-in-your-terminal/&#34;&gt;following blog post by Karl Tryggvason&lt;/a&gt; shows a simple script to get data from a JSON Web Token (JWT) using &lt;code&gt;jq&lt;/code&gt;.
It is basically splitting the token on the &lt;code&gt;.&lt;/code&gt; and then convert each part from base64 encoding.
As extra functionality the timestamp fields &lt;code&gt;exp&lt;/code&gt; and &lt;code&gt;iat&lt;/code&gt; are converted to human readable dates.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The following custom Nushell command implements the same functionality.
The command uses some helper internal commands to convert the timestamp values and decoding from base64.
The token is split using &lt;code&gt;split row&lt;/code&gt; and then each part is transformed to a record with keys and values.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-nu hljs&#34; data-lang=&#34;nu&#34;&gt;# Extract header and payload from JSON Web Token (JWT).
#
# Use as command:
#   jwt &#39;eyJhbGciOiJIU...&#39;
#
# Use in pipeline:
#   &#39;eyJhbGciOiJIU...&#39; | jwt
#
def jwt [
  token?: string # JWT token string (optional, can be passed via pipeline)
] : [string -&amp;gt; record, nothing -&amp;gt; record] {

  # Convert timestamp in milliseconds to date value.
  let to_date = { into datetime -f &#39;%s&#39; | format date &#39;%+&#39; }

  # Split token on . and get first 2 rows containing the header and payload.
  # Decode each to record.
  let parts = ($in | default $token)
    | split row &#39;.&#39;
    | take 2
    | each { decode base64 --nopad --url | decode utf-8 | from json }

  {
    header: $parts.0
    payload: ($parts.1
      | update exp? $to_date
      | update iat? $to_date
      | update nbf? $to_date)
  }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;You can use the &lt;code&gt;jwt&lt;/code&gt; command both as a command with an input argument and as pipeline element.
The output is a record with header and payload data from the JWT.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-plain hljs&#34; data-lang=&#34;plain&#34;&gt;&amp;gt; let $jwt_token = &#39;eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
[&#39;
&amp;gt; jwt $jwt_token
 header     alg   HS256
            typ   JWT
 payload    sub    1234567890
            name   John Doe
            iat    2018-01-18T01:30:22+00:00
&amp;gt; $jwt_token | jwt
 header     alg   HS256
            typ   JWT
 payload    sub    1234567890
            name   John Doe
            iat    2018-01-18T01:30:22+00:00&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Written with Nushell 0.116.1.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;&lt;a href=&#34;https://blog.mrhaki.com/2026/10/nushell-niceties-parsing-jwt.html&#34;&gt;Original post&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;</content>
        <category term="Nushell" scheme="https://jdriven.com/blog/category/Nushell/" />
        <category term="JWT" scheme="https://jdriven.com/blog/tag/JWT/" />
        <category term="Nushell" scheme="https://jdriven.com/blog/tag/Nushell/" />
        <category term="CLI" scheme="https://jdriven.com/blog/tag/CLI/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/Mastering-Maven-Failing-Faster-With-Failing-Tests/</id>
        <title>Mastering Maven: Failing Faster With Failing Tests</title>
        <social:hashtags>#Maven</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/Mastering-Maven-Failing-Faster-With-Failing-Tests/"/>
        <published>2026-10-19T06:57:04.000Z</published>
        <updated>2026-10-19T06:57:04.000Z</updated>
        <author>
            <name>mrhaki</name>
            <social:mastodon>mrhaki@mastodon.online</social:mastodon>
            <social:bluesky>mrhaki.com</social:bluesky>
            <uri>https://jdriven.com/blog/author/mrhaki</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Maven uses the &lt;a href=&#34;https://maven.apache.org/surefire/maven-surefire-plugin/&#34;&gt;Surefire plugin&lt;/a&gt; to run unit tests and the &lt;a href=&#34;https://maven.apache.org/surefire/maven-failsafe-plugin/index.html&#34;&gt;Failsafe plugin&lt;/a&gt; to run integration tests.
The default behaviour of Maven is to run all tests and show a summary at the end.
The summary shows how many tests have run and how many failures, errors and skipped tests happened.
So every time when you run &lt;code&gt;mvn test&lt;/code&gt; or &lt;code&gt;mvn verify&lt;/code&gt; all tests will be executed, even when tests are failing.
You can speed up your build by stop running tests once a test fails.
You must use the Java system properties &lt;code&gt;surefire.skipAfterFailureCount&lt;/code&gt; and &lt;code&gt;failsafe.skipAfterFailureCount&lt;/code&gt; to make sure Maven will skip running any tests after a test failure has occurred.
You can specify a number with the parameter to set how many tests should fail before other tests are skipped.
It is possible use these parameters in the plugin configuration in your &lt;code&gt;pom.xml&lt;/code&gt; as well.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Maven uses the &lt;a href=&#34;https://maven.apache.org/surefire/maven-surefire-plugin/&#34;&gt;Surefire plugin&lt;/a&gt; to run unit tests and the &lt;a href=&#34;https://maven.apache.org/surefire/maven-failsafe-plugin/index.html&#34;&gt;Failsafe plugin&lt;/a&gt; to run integration tests.
The default behaviour of Maven is to run all tests and show a summary at the end.
The summary shows how many tests have run and how many failures, errors and skipped tests happened.
So every time when you run &lt;code&gt;mvn test&lt;/code&gt; or &lt;code&gt;mvn verify&lt;/code&gt; all tests will be executed, even when tests are failing.
You can speed up your build by stop running tests once a test fails.
You must use the Java system properties &lt;code&gt;surefire.skipAfterFailureCount&lt;/code&gt; and &lt;code&gt;failsafe.skipAfterFailureCount&lt;/code&gt; to make sure Maven will skip running any tests after a test failure has occurred.
You can specify a number with the parameter to set how many tests should fail before other tests are skipped.
It is possible use these parameters in the plugin configuration in your &lt;code&gt;pom.xml&lt;/code&gt; as well.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In the following example you see first the results of a default &lt;code&gt;mvn test&lt;/code&gt; run where two failures happen in the test set:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-plain hljs&#34; data-lang=&#34;plain&#34;&gt;&amp;gt; mvn test
...
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   HelloServiceTest.helloWithName:28
expected: &#34;Hello mrhaki!&#34;
 but was: &#34;Hello mrhaki&#34;
[ERROR]   HelloServiceTest.helloWithWorld:21
expected: &#34;Hello World!&#34;
 but was: &#34;Hello World&#34;
[INFO]
[ERROR] Tests run: 5, Failures: 2, Errors: 0, Skipped: 0
...
&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;By using the Java system properties &lt;code&gt;surefire.skipAfterFailureCount&lt;/code&gt; and &lt;code&gt;failsafe.skipAfterFailureCount&lt;/code&gt; with the value &lt;code&gt;1&lt;/code&gt; you can see in the output tests were skipped after the first failure:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-plain hljs&#34; data-lang=&#34;plain&#34;&gt;&amp;gt; mvn test -Dsurefire.skipAfterFailureCount=1
...
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   HelloServiceTest.helloWithWorld:21
expected: &#34;Hello World!&#34;
 but was: &#34;Hello World&#34;
[INFO]
[ERROR] Tests run: 5, Failures: 1, Errors: 0, Skipped: 1
...
&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Notice that tests that have run before the failing test are still executed.
So in the previous example some time is saved by skipping a test.
In larger codebases the number of skipped tests can be larger and the build will fail faster than running all tests.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;But still to fail faster you want to skip all tests except the failing tests.
The order of running tests is by default the location on the file system of the test classes.
So if your failing tests location is one of the last to be executed you are not failing much faster.
But you can change the order of tests that are executed.
In this case we want to have the failing tests run first, so we can work on fixing the test and run the test suite and fail fast this time if the fix is not enough.
With the system properties &lt;code&gt;surefire.runOrder&lt;/code&gt; and &lt;code&gt;failsafe.runOrder&lt;/code&gt; you can change the ordering of tests.
The value &lt;code&gt;failedFirst&lt;/code&gt; will run tests that failed on a previous run first.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In the following example the run order is set to &lt;code&gt;failedFirst&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-plain hljs&#34; data-lang=&#34;plain&#34;&gt;&amp;gt; mvn test -Dsurefire.skipAfterFailureCount=1 -Dsurefire.runOrder=failedFirst
...
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   HelloServiceTest.helloWithWorld:21
expected: &#34;Hello World!&#34;
 but was: &#34;Hello World&#34;
[INFO]
[ERROR] Tests run: 5, Failures: 1, Errors: 0, Skipped: 4
...
&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;This time 4 tests are skipped and only the failed test is executed.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Instead of using Java system properties set using the command line you can change the configuration of the Surefire and FailSafe plugins in your &lt;code&gt;pom.xml&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-xml hljs&#34; data-lang=&#34;xml&#34;&gt;...
  &amp;lt;build&amp;gt;
    &amp;lt;plugins&amp;gt;
    ...
      &amp;lt;plugin&amp;gt;
        &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
        &amp;lt;artifactId&amp;gt;maven-surefire-plugin&amp;lt;/artifactId&amp;gt;
        &amp;lt;configuration&amp;gt;
          &amp;lt;!-- Set configuration for fail fast --&amp;gt;
          &amp;lt;skipAfterFailureCount&amp;gt;1&amp;lt;/skipAfterFailureCount&amp;gt;
          &amp;lt;runOrder&amp;gt;failedfirst&amp;lt;/runOrder&amp;gt;
        &amp;lt;/configuration&amp;gt;
      &amp;lt;/plugin&amp;gt;
      &amp;lt;plugin&amp;gt;
        &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
        &amp;lt;artifactId&amp;gt;maven-failsafe-plugin&amp;lt;/artifactId&amp;gt;
        &amp;lt;configuration&amp;gt;
          &amp;lt;!-- Set configuration for fail fast --&amp;gt;
          &amp;lt;skipAfterFailureCount&amp;gt;1&amp;lt;/skipAfterFailureCount&amp;gt;
          &amp;lt;runOrder&amp;gt;failedfirst&amp;lt;/runOrder&amp;gt;
        &amp;lt;/configuration&amp;gt;
      &amp;lt;/plugin&amp;gt;
...&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Written with Maven 3.9.10.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;&lt;a href=&#34;https://blog.mrhaki.com/2026/10/mastering-maven-failing-faster-with.html&#34;&gt;Original post&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;</content>
        <category term="Maven" scheme="https://jdriven.com/blog/category/Maven/" />
        <category term="Maven" scheme="https://jdriven.com/blog/tag/Maven/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/the-cost-of-frozen-code/</id>
        <title>The cost of frozen code</title>
        <social:hashtags>#Java #Concurrency #AzureDurableFunctions #CloudCostOptimization</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/the-cost-of-frozen-code/"/>
        <published>2026-10-16T05:00:00.000Z</published>
        <updated>2026-10-16T05:00:00.000Z</updated>
        <author>
            <name>Tundzaj Barov</name>
            <uri>https://jdriven.com/blog/author/tundzaj-barov</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In my previous post, &lt;a href=&#34;/blog/2026/10/The-Azure-Scale-Controller-is-Wilding-Build-Your-Own-Java-Fan-Out-Orchestrator&#34;&gt;The Azure Scale Controller is Wilding: Build Your Own Java Fan-Out Orchestrator&lt;/a&gt;, we explored how Azure&amp;#8217;s default queue autoscaling can easily overwhelm downstream services during large fan-out operations.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;While managing concurrency solves rate-limiting issues, another silent budget-killer remains: unresponsive, frozen code.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In my previous post, &lt;a href=&#34;/blog/2026/10/The-Azure-Scale-Controller-is-Wilding-Build-Your-Own-Java-Fan-Out-Orchestrator&#34;&gt;The Azure Scale Controller is Wilding: Build Your Own Java Fan-Out Orchestrator&lt;/a&gt;, we explored how Azure&amp;#8217;s default queue autoscaling can easily overwhelm downstream services during large fan-out operations.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;While managing concurrency solves rate-limiting issues, another silent budget-killer remains: unresponsive, frozen code.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Billing &amp;amp; duration&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;To understand why a frozen thread is so dangerous to your cloud budget, you must first understand how serverless compute is billed—specifically, how the duration metric behaves.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In serverless architectures, pay-per-use can create a false sense of financial safety. We assume that if code isn’t doing useful work, we aren’t paying for it. However, when functions freeze or stall on unresponsive dependencies, that safety net vanishes.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;On Azure serverless hosting plans (flex consumption as well as classic consumption), compute cost depends on elapsed &lt;strong&gt;wall-clock execution time&lt;/strong&gt;, not active CPU utilization:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Activity &amp;amp; standard functions: Run continuously from invocation start to finish. If an execution thread sits idle at 0% cpu for 10 minutes waiting on a stuck network socket or slow database query, you pay for all 10 minutes of compute time.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Orchestrator functions (durable functions): When an orchestrator reaches an await point, its execution yields, state checkpoints, and billing stops completely while waiting for downstream events.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Non-HTTP failure modes in java&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;When integrating Azure Durable Functions with unstable dependencies, not every operation goes over a standard HTTP client with built-in request timeouts. In Java systems, Activity functions often run non-HTTP operations that fall into two main failure modes:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;olist arabic&#34;&gt;
&lt;ol class=&#34;arabic&#34;&gt;
&lt;li&gt;
&lt;p&gt;Third-Party SDKs &amp;amp; Legacy Libraries: Operations executing synchronous, blocking calls without exposing built-in async interfaces or clean timeout options.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Database &amp;amp; Data Layer Operations: Calls trapped in native socket read locks, connection pool exhaustion, or driver-level deadlocks.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Enforce boundaries&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;To prevent non-HTTP legacy code and database locks from freezing your activity worker thread and burning serverless budget, decouple task execution from the primary activity function invocation:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;olist arabic&#34;&gt;
&lt;ol class=&#34;arabic&#34;&gt;
&lt;li&gt;
&lt;p&gt;Offload to a single-thread executor: Create a dedicated, single-use single-thread executor inside the activity function invocation. This ensures the background task starts running immediately without waiting in an internal queue.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Apply a hard time limit: Wrap the task in a Future and enforce a strict timeout using future.get(timeout, time unit seconds). Because there is no internal queue, the task receives its full execution budget immediately upon submission.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Handle thread interrupts and clean up: If the operation exceeds the threshold, invoke executor.shutdownNow() inside a finally block to issue an interrupt signal to the background worker thread, then raise a structured runtime exception back to the orchestrator.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The code implementation&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Here is how to safely wrap blocking library calls inside an Azure Durable Functions Activity using a dedicated single-thread executor to prevent runaway execution costs, paired with a sliding-window fan-out orchestrator.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;olist arabic&#34;&gt;
&lt;ol class=&#34;arabic&#34;&gt;
&lt;li&gt;
&lt;p&gt;HTTP starter function (StartOrchestrationFunction.java)&lt;/p&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Triggers the fan-out orchestrator and returns the instance ID:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package com.example;

import com.microsoft.azure.functions.*;
import com.microsoft.azure.functions.annotation.AuthorizationLevel;
import com.microsoft.azure.functions.annotation.FunctionName;
import com.microsoft.azure.functions.annotation.HttpTrigger;
import com.microsoft.durabletask.DurableTaskClient;
import com.microsoft.durabletask.azurefunctions.DurableClientContext;
import com.microsoft.durabletask.azurefunctions.DurableClientInput;

import java.util.Optional;

public class StartOrchestrationFunction {
    @FunctionName(&#34;start-fan-out&#34;)
    public HttpResponseMessage start(
            @HttpTrigger(
                    name = &#34;req&#34;,
                    methods = {HttpMethod.POST},
                    authLevel = AuthorizationLevel.ANONYMOUS)
            HttpRequestMessage&amp;lt;Optional&amp;lt;String&amp;gt;&amp;gt; request,
            @DurableClientInput(name = &#34;durableContext&#34;) DurableClientContext durableContext,
            final ExecutionContext context) {

        DurableTaskClient client = durableContext.getClient();

        String instanceId = client.scheduleNewOrchestrationInstance(&#34;mini-fan-out-orchestrator&#34;);

        return request.createResponseBuilder(HttpStatus.ACCEPTED)
                .header(&#34;Content-Type&#34;, &#34;application/json&#34;)
                .body(String.format(&#34;{\&#34;instanceId\&#34;: \&#34;%s\&#34;}&#34;, instanceId))
                .build();
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Data transfer object (ActivityInput.java)&lt;/p&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Passes an identifier and a sleep duration payload to the activity function:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package com.example;

public class ActivityInput {
    private String id;
    private int seconds;

    public ActivityInput() {}

    public ActivityInput(String id, int seconds) {
        this.id = id;
        this.seconds = seconds;
    }

    public String getId() { return id; }
    public void setId(String id) { this.id = id; }

    public int getSeconds() { return seconds; }
    public void setSeconds(int seconds) { this.seconds = seconds; }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The throttled orchestrator (MiniOrchestrator.java)&lt;/p&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Simulates a batch data extraction pipeline with a max concurrency of 2. Each activity enforces a strict 3-second boundary using a dedicated single-thread executor. If a task hits a database lock or frozen SDK connection, the activity interrupts its worker thread and throws an exception after 3 seconds. The orchestrator does not handle this failure, so the orchestration fails and no further tasks are scheduled. In production you would catch the TaskFailedException (or configure a retry policy) and decide per item whether to continue, retry or compensate.
This sliding-window pattern is meant for small batches: the orchestrator is replayed against its full history, which grows with every scheduled and completed activity. For thousands of items, use sub-orchestrations (chunking) or continueAsNew.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package com.example;

import com.microsoft.azure.functions.annotation.FunctionName;
import com.microsoft.durabletask.Task;
import com.microsoft.durabletask.TaskOrchestrationContext;
import com.microsoft.durabletask.azurefunctions.DurableOrchestrationTrigger;

import java.util.*;

public class MiniOrchestrator {

    @FunctionName(&#34;mini-fan-out-orchestrator&#34;)
    public void run(@DurableOrchestrationTrigger(name = &#34;ctx&#34;) TaskOrchestrationContext ctx) {
        int maxConcurrency = 2;

        List&amp;lt;ActivityInput&amp;gt; items = List.of(
                new ActivityInput(&#34;Task-1&#34;, 1),
                new ActivityInput(&#34;Task-2&#34;, 1),
                new ActivityInput(&#34;Task-3&#34;, 4), // Exceeds 3s limit
                new ActivityInput(&#34;Task-4&#34;, 5), // Exceeds 3s limit
                new ActivityInput(&#34;Task-5&#34;, 2)  // Never gets processed
        );

        Queue&amp;lt;ActivityInput&amp;gt; remaining = new LinkedList&amp;lt;&amp;gt;(items);
        Set&amp;lt;Task&amp;lt;?&amp;gt;&amp;gt; runningTasks = new HashSet&amp;lt;&amp;gt;();

        while (runningTasks.size() &amp;lt; maxConcurrency &amp;amp;&amp;amp; !remaining.isEmpty()) {
            runningTasks.add(ctx.callActivity(&#34;process-item&#34;, remaining.poll(), Void.class));
        }

        while (!remaining.isEmpty()) {
            Task&amp;lt;?&amp;gt; completed = ctx.anyOf(runningTasks.toArray(new Task[0])).await();
            runningTasks.remove(completed);
            runningTasks.add(ctx.callActivity(&#34;process-item&#34;, remaining.poll(), Void.class));
        }

        while (!runningTasks.isEmpty()) {
            Task&amp;lt;?&amp;gt; completed = ctx.anyOf(runningTasks.toArray(new Task[0])).await();
            runningTasks.remove(completed);
        }
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Isolated Process Item Activity (ProcessItemActivity.java)&lt;/p&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Uses a dedicated Executors.newSingleThreadExecutor() per activity invocation to enforce a hard 3-second boundary without internal queue delays:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package com.example;

import com.microsoft.azure.functions.ExecutionContext;
import com.microsoft.azure.functions.annotation.FunctionName;
import com.microsoft.durabletask.azurefunctions.DurableActivityTrigger;
import java.util.concurrent.*;

public class ProcessItemActivity {

    private static final long TIMEOUT_TIME_SECONDS = 3L;

    @FunctionName(&#34;process-item&#34;)
    public void processItem(
            @DurableActivityTrigger(name = &#34;input&#34;) ActivityInput input,
            final ExecutionContext context) throws Exception {

        context.getLogger().info(&#34;Starting &#34; + input.getId() + &#34; (sleep &#34; + input.getSeconds() + &#34;s)...&#34;);

        ExecutorService executor = Executors.newSingleThreadExecutor();

        try {
            Future&amp;lt;?&amp;gt; future = executor.submit(() -&amp;gt; {
                try {
                    Thread.sleep(input.getSeconds() * 1000L);
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            });

            future.get(TIMEOUT_TIME_SECONDS, TimeUnit.SECONDS);
            context.getLogger().info(input.getId() + &#34; completed successfully.&#34;);
        } catch (TimeoutException e) {
            context.getLogger().warning(input.getId() + &#34; EXCEEDED &#34; + TIMEOUT_TIME_SECONDS + &#34;s limit! Canceling...&#34;);
            throw new RuntimeException(input.getId() + &#34; timed out after &#34; + TIMEOUT_TIME_SECONDS + &#34;s.&#34;, e);
        } catch (ExecutionException e) {
            Throwable cause = e.getCause();
            context.getLogger().severe(input.getId() + &#34; failed: &#34; + cause.getMessage());
            throw new RuntimeException(input.getId() + &#34; failed: &#34; + cause.getMessage(), cause);
        } finally {
            executor.shutdownNow();
        }
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Understanding thread leakage and interrupt limits&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;With a max concurrency of 2, Task-3 (4s) and Task-4 (5s) start as soon as Tasks 1 and 2 finish, running in parallel. Both exceed the 3-second boundary, timing out 3 seconds after they are invoked.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;When the tasks time out:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;olist arabic&#34;&gt;
&lt;ol class=&#34;arabic&#34;&gt;
&lt;li&gt;
&lt;p&gt;executor.shutdownNow() issues a thread interrupt signal to request the background thread to stop.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The activity function throws a RuntimeException, which the runtime reports to the orchestrator as a failed activity task. Inside the orchestrator, ctx.anyOf(...).await() receives the failure and throws a TaskFailedException. Because the orchestrator does not catch this exception, the orchestration instance immediately aborts as &lt;strong&gt;Failed&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Task-5 is never scheduled: new tasks are only scheduled when a running task completes successfully, but the unhandled TaskFailedException aborts the orchestrator first.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class=&#34;admonitionblock caution&#34;&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td class=&#34;icon&#34;&gt;
&lt;i class=&#34;fa icon-caution&#34; title=&#34;Caution&#34;&gt;&lt;/i&gt;
&lt;/td&gt;
&lt;td class=&#34;content&#34;&gt;
&lt;div class=&#34;title&#34;&gt;Production Implementation Disclaimer&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Calling &lt;code&gt;shutdownNow()&lt;/code&gt; only issues a Java thread interrupt (&lt;code&gt;Thread.interrupt()&lt;/code&gt;), which legacy database drivers and native SDKs performing uninterruptible socket reads ignore. Because Azure keeps the JVM worker process warm between function executions, each timed-out call leaves an orphaned background thread running in the host process (1 leaked thread per invocation). These orphaned threads remain trapped in memory until the worker instance eventually scales down to zero or recycles due to inactivity.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;When an activity times out, the orchestrator aborts immediately and will not schedule remaining tasks.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;To mitigate thread leaks in code, you can use a static &lt;code&gt;Semaphore&lt;/code&gt; to bound background thread creation, but &lt;strong&gt;its permit count must be sized at least as large as the orchestrator&amp;#8217;s max concurrency threshold&lt;/strong&gt; to prevent artificial capacity bottlenecks. Always pair this with driver-level &lt;code&gt;socketTimeout&lt;/code&gt; settings and daemon threads.&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;On Azure Functions, leaving execution limits to the default host timeouts means a single frozen dependency can keep an invocation, and its billing meter, running for the full host timeout: by default up to 30 minutes on Flex Consumption, Premium and Dedicated plans, and longer if configured as unbounded. Combining orchestrator concurrency control with activity calls wrapped in an explicit time limit lets stalled operations fail fast in seconds instead.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;This bounds the &lt;strong&gt;invocation&lt;/strong&gt;, and with it what you are billed for a stuck call. It does not by itself stop the background thread: calls that ignore interrupts need their own client-side timeouts, concurrent background calls should be capped, and activities should stay idempotent. Applied with those caveats, taking ownership of your execution boundaries keeps one frozen dependency from tying up your workers and makes your cloud bill more predictable.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Java" scheme="https://jdriven.com/blog/category/Java/" />
        <category term="Cloud Architectuur" scheme="https://jdriven.com/blog/category/Cloud-Architectuur/" />
        <category term="Serverless" scheme="https://jdriven.com/blog/category/Cloud-Architectuur/Serverless/" />
        <category term="Java" scheme="https://jdriven.com/blog/tag/Java/" />
        <category term="Concurrency" scheme="https://jdriven.com/blog/tag/Concurrency/" />
        <category term="Azure Durable Functions" scheme="https://jdriven.com/blog/tag/Azure-Durable-Functions/" />
        <category term="Cloud Cost Optimization" scheme="https://jdriven.com/blog/tag/Cloud-Cost-Optimization/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/coffeemachine/</id>
        <title>The coffee machine still matters</title>
        <social:hashtags>#AI #Techradar</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/coffeemachine/"/>
        <published>2026-10-15T05:56:00.000Z</published>
        <updated>2026-10-15T05:56:00.000Z</updated>
        <author>
            <name>Erik</name>
            <social:mastodon>erikj@mastodon.nl</social:mastodon>
            <uri>https://jdriven.com/blog/author/erik-pronk</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;A while ago I was stuck on a problem. I had been turning it over on my own for the better part of a morning, and I was not getting anywhere.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Then I walked to the coffee machine. A colleague asked what I was working on, I explained it in two sentences, and before my cup was even full he said something that pointed me straight at the answer.
No meeting, no ticket, no scheduled call. Just two people standing next to a machine that makes mediocre coffee, tea for me.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;That is the kind of moment I have been missing, and I think a lot of teams are missing it too.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;A while ago I was stuck on a problem. I had been turning it over on my own for the better part of a morning, and I was not getting anywhere.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Then I walked to the coffee machine. A colleague asked what I was working on, I explained it in two sentences, and before my cup was even full he said something that pointed me straight at the answer.
No meeting, no ticket, no scheduled call. Just two people standing next to a machine that makes mediocre coffee, tea for me.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;That is the kind of moment I have been missing, and I think a lot of teams are missing it too.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;An acquired right&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Since the corona period, working from home has become a kind of acquired right.
And I understand why.
It gives people focus, saves them a commute, and lets them shape their day around their life instead of the other way around.
I wrote about the value of staying connected during those disconnected times in &lt;a href=&#34;https://jdriven.com/blog/2020/10/How-to-stay-connected-during-disconnected-times/&#34;&gt;How to stay connected during disconnected times&lt;/a&gt;, and a lot of what we learned then still holds.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;But something has shifted.
Getting a team together in the same room, even now and then, has become surprisingly hard.
It can feel like you are asking for a favour rather than organising a normal day of work.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Let me be clear about one thing: I am not saying we should go back to the office every day.
That ship has sailed, and honestly, it should have.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;What I am saying is that we have lost something, and it is worth naming what that something is.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;What the same room gives you&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Some of the most valuable things about working together do not show up in a planning tool.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;There are the coffee machine conversations, the ones nobody scheduled.
Half of them are about the weekend, but the other half are where problems quietly get solved.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;There is the difference in explaining something while you stand next to each other.
At a whiteboard, with a pen in your hand, you understand your own idea better by the time you have finished drawing it.
Something comes out of that shared space that a screen share rarely gives you.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;And there is the feeling of not having to solve a problem on your own.
At home there can be a threshold before you ask for help.
You do not want to interrupt, so you send a careful message, or you decide to struggle on for another hour first.
In the same room you simply turn your chair around.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;AI is not a colleague&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;There is a tempting shortcut here.
If it is hard to reach a colleague, why not ask the AI instead?&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;AI can help with plenty, and I use it regularly.
But a conversation with an AI is not the same as a conversation with a colleague.
It tends to agree with you, build on your framing, and hand back a tidy version of what you already thought.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I called this the echo chamber effect in &lt;a href=&#34;https://jdriven.com/blog/2026/04/AI-team-dynamics-1/&#34;&gt;AI&amp;#8217;s Impact on Team Dynamics (Part 1)&lt;/a&gt;.
A colleague does the opposite.
They push back, ask the question you were avoiding, and bring a perspective you did not have.
That friction is exactly what you miss when you work on your own.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Not back to the office, but a rhythm&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;So what is the answer?&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I do not think it is a mandate.
&#34;Everyone coming into the office three days a week&#34; treats presence as the goal, when presence was never the goal. Good work and a healthy team are.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I think the answer is a natural rhythm.
A team comes together when the situation calls for it, and stays apart when it does not.
Kicking off something new, untangling a hard problem, welcoming a new team member, or simply feeling the temperature of the group again.
These are the moments that are worth the trip.
A quiet day of individual work is not.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;This asks something of the team.
It asks for the maturity to judge when being together actually helps, and the trust to let the team make that call rather than having it dictated from above.
As I wrote in &lt;a href=&#34;https://jdriven.com/blog/2025/10/Team-dynamics-to-the-rescue/&#34;&gt;Team dynamics to the rescue!&lt;/a&gt;, the real power of a team lives in something deeper than its tools.
This is part of that something.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Finding the rhythm&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;So how do you find that rhythm without slipping back into old habits?&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;It starts with tying the moments you come together to the work itself.
Meet for a kickoff, a hard design problem, or an onboarding, the kind of thing where being in the same room clearly helps, and let the quiet days of individual work happen at home.
Presence should mean something, otherwise it is just a commute with extra steps.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Where you can, let the team own that calendar.
The people doing the work usually know when they need each other, and trusting them to make that call beats any rule handed down from above.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;And when you do come together, protect the informal.
Do not pack the day so full that the coffee machine conversations have nowhere to happen.
Those unplanned moments are half the reason to be there in the first place.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;As for AI, keep using it, but keep a person in the loop too.
When something feels important, take it to a colleague as well, and give them the space to disagree with you.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Final thoughts&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Working from home is here to stay, and I am glad it is.
But we should be honest that something got lost when we stopped standing in the same room.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The overheard remark at the coffee machine, the whiteboard, the chair you turn around when you are stuck. Small things on their own, and together they are a big part of how a team actually works.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;None of this is a call to go back to how it was.
It is a call to be deliberate about coming together when the work asks for it, and relaxed about staying apart when it does not.
Your team can feel that difference.
Give them the room to act on it.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Software Engineering" scheme="https://jdriven.com/blog/category/Software-Engineering/" />
        <category term="Tech Culture" scheme="https://jdriven.com/blog/category/Software-Engineering/Tech-Culture/" />
        <category term="AI" scheme="https://jdriven.com/blog/tag/AI/" />
        <category term="Techradar" scheme="https://jdriven.com/blog/tag/Techradar/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/a-diy-localstack-for-google-APIs-with-wiremock-and-testcontainers/</id>
        <title>A DIY LocalStack for Google APIs with WireMock and TestContainers</title>
        <social:hashtags>#SpringBoot #WireMock #TestContainers #GoogleWorkspace</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/a-diy-localstack-for-google-APIs-with-wiremock-and-testcontainers/"/>
        <published>2026-10-14T05:00:00.000Z</published>
        <updated>2026-10-14T05:00:00.000Z</updated>
        <author>
            <name>Arjen</name>
            <social:twitter>tebbenhof</social:twitter>
            <social:mastodon>tebbenhof@mastodon.social</social:mastodon>
            <social:bluesky>arjen.tebbenhof.nl</social:bluesky>
            <uri>https://jdriven.com/blog/author/arjen-tebbenhof</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Discover how to build your own, offline &#34;LocalStack&#34; for Google APIs using WireMock
and TestContainers. In this post, I will show you how to set up a two-purpose
mocking strategy. By writing your JSON mock responses just once, you can reuse them
to power automated integration tests &lt;strong&gt;and&lt;/strong&gt; spin up a standalone mock server for
local (UI) development. No more production data and sharing of google keys between
developers, no more &lt;code&gt;403 User Rate Limit Exceeded&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Discover how to build your own, offline &#34;LocalStack&#34; for Google APIs using WireMock
and TestContainers. In this post, I will show you how to set up a two-purpose
mocking strategy. By writing your JSON mock responses just once, you can reuse them
to power automated integration tests &lt;strong&gt;and&lt;/strong&gt; spin up a standalone mock server for
local (UI) development. No more production data and sharing of google keys between
developers, no more &lt;code&gt;403 User Rate Limit Exceeded&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In my previous post, I wrote about &lt;a href=&#34;/blog/2026/10/learning-by-steering&#34;&gt;building
internal tools using an AI web client as a sparring partner&lt;/a&gt;. When I initially set
out to build a Google Workspace integration, with a backend API and an HTMX web
dashboard, I faced a classic development challenge: how do I properly test this
without constantly hitting the live Google APIs? And how can other developers
contribute without the need of our production keys?&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I wanted to mock the API for my automated integration tests, but I also wanted to
spin up the local UI and click around without triggering real network calls. For
AWS developers, LocalStack is the go-to solution for offline testing. For Google
Workspace, there is currently a new service in public preview called
&lt;a href=&#34;https://local.cloud&#34;&gt;local.cloud&lt;/a&gt;. However, at that time it didn&amp;#8217;t exist, and
moreover I wanted a free, self-hosted alternative that gave me full control.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I ended up building my own &#34;LocalStack&#34; using WireMock and TestContainers. This
setup paid off really well. Later on, when the application&amp;#8217;s scope expanded to
audit deep folder permissions via the Google Drive API, I was able to use this
exact same mock setup to safely simulate rate limit errors and properly test my
exponential backoff logic.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;imageblock text-center&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;/blog/uploads/2026/10/localstack-for-google-apis.jpg&#34; alt=&#34;localstack for google apis&#34; width=&#34;50%&#34;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Here is how you can set this up for your own projects.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Step 1: The Shared Mock Payloads (JSON)&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The foundation of this approach is separating your mock definitions from your Java
code. I want to store the payloads exactly once, and share them between our Java
Integration Tests (during the test phase) and our local standalone Docker
environment (during local development).&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;To make everything play nicely with both Spring&amp;#8217;s test classpath and Docker
Compose, I split the response payloads (&lt;code&gt;__files&lt;/code&gt;) from the standalone routing
definitions (&lt;code&gt;mappings&lt;/code&gt;):&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-text hljs&#34; data-lang=&#34;text&#34;&gt;.
├── src/
│   └── test/
│       └── resources/
│           └── __files/
│               ├── google_list_users.json
│               ├── google_drive_rate_limit.json
│               └── google_drive_permissions.json
└── wiremock/
    └── mappings/
        ├── get_directory_users.json
        └── get_drive_permissions.json&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;You only have to copy-paste the raw API responses into the &lt;code&gt;__files&lt;/code&gt; directory once.
For example:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;src/test/resources/__files/google_list_users.json&lt;/code&gt;&lt;/strong&gt;:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-json hljs&#34; data-lang=&#34;json&#34;&gt;{
  &#34;kind&#34;: &#34;admin#directory#users&#34;,
  &#34;users&#34;: [
    {
      &#34;id&#34;: &#34;user-id-1&#34;,
      &#34;primaryEmail&#34;: &#34;sullivan@monstersinc.com&#34;,
      &#34;name&#34;: {
        &#34;givenName&#34;: &#34;James&#34;,
        &#34;familyName&#34;: &#34;Sullivan&#34;,
        &#34;fullName&#34;: &#34;James P. Sullivan&#34;
      },
      &#34;orgUnitPath&#34;: &#34;/Scare Floor F&#34;
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Step 2: Automated Integration Tests&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;For our integration tests, I use the WireMock Java Client to programmatically route
requests to our shared JSON payloads. This is a best practice, as it keeps the test
scenario isolated within the test method.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;First, add the TestContainers WireMock module to your &lt;code&gt;pom.xml&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-xml hljs&#34; data-lang=&#34;xml&#34;&gt;&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.wiremock.integrations.testcontainers&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;wiremock-testcontainers-module&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.0-alpha-15&amp;lt;/version&amp;gt;
    &amp;lt;scope&amp;gt;test&amp;lt;/scope&amp;gt;
&amp;lt;/dependency&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Next, I set up the Integration Test. There are three important tricks here:
1. I construct the &lt;code&gt;WireMockContainer&lt;/code&gt; and map the &lt;code&gt;__files&lt;/code&gt; from our test classpath
into the container.
2. I use &lt;code&gt;@DynamicPropertySource&lt;/code&gt; to dynamically override the Spring Boot base URL
so the Google API Client points to our container.
3. I bypass the official Google SDK credential checks by mocking the AuthManager
with &lt;code&gt;@MockitoBean&lt;/code&gt; and returning an empty &lt;code&gt;HttpRequestInitializer&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;@SpringBootTest
@Testcontainers
class GoogleApiAdapterIT {

    @Container
    static WireMockContainer wiremockServer = new WireMockContainer(&#34;wiremock/wiremock:latest&#34;)
            .withClasspathResourceMapping(&#34;__files&#34;, &#34;/home/wiremock/__files&#34;, BindMode.READ_ONLY);

    @DynamicPropertySource
    static void configureProperties(DynamicPropertyRegistry registry) {
        // Overrides the base-url in application.yaml to point to the test container
        registry.add(&#34;google.base-url&#34;, () -&amp;gt; wiremockServer.getBaseUrl() + &#34;/&#34;);
    }

    @MockitoBean
    private GoogleAuthManager authManager;

    @Autowired
    private GoogleDriveAdapter adapter;

    @BeforeEach
    void setUp() throws Exception {
        // Return an empty functionless HttpRequestInitializer for testing, skipping real OAuth
        when(authManager.getCredentialsForWorkspace(any())).thenReturn(request -&amp;gt; {});
    }

    @Test
    void shouldRetryOnUserRateLimitExceededAndEventuallySucceed() {
        WireMock wireMockClient = new WireMock(wiremockServer.getHost(), wiremockServer.getPort());

        // Stateful Mocking: Fail the first time, succeed on the retry!
        wireMockClient.register(
                get(urlPathEqualTo(&#34;/drive/v3/files/FILE-123/permissions&#34;))
                        .inScenario(&#34;RateLimitScenario&#34;)
                        .whenScenarioStateIs(Scenario.STARTED)
                        .willReturn(aResponse()
                                .withStatus(403)
                                .withHeader(&#34;Content-Type&#34;, &#34;application/json&#34;)
                                .withBodyFile(&#34;google_drive_rate_limit.json&#34;)) // Uses our shared file!
                        .willSetStateTo(&#34;RETRY_SUCCESS&#34;)
        );

        wireMockClient.register(
                get(urlPathEqualTo(&#34;/drive/v3/files/FILE-123/permissions&#34;))
                        .inScenario(&#34;RateLimitScenario&#34;)
                        .whenScenarioStateIs(&#34;RETRY_SUCCESS&#34;)
                        .willReturn(aResponse()
                                .withStatus(200)
                                .withHeader(&#34;Content-Type&#34;, &#34;application/json&#34;)
                                .withBodyFile(&#34;google_drive_permissions.json&#34;)) // Uses our shared file!
        );

        // Because of our stateful WireMock scenario, the adapter will hit a 403 first,
        // trigger the Spring @Retryable backoff, and succeed on the second attempt.
        List&amp;lt;DrivePermissionOverride&amp;gt; overrides = adapter.getPermissionOverrides(&#34;MONSTERS_INC&#34;, targetDrive);

        assertThat(overrides).isNotEmpty();
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Step 3: Local Standalone Server for UI and Manual Testing&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;With the automated tests running properly, you might want to boot up the application
locally to test your frontend or manually invoke your CLI commands. Since I can&amp;#8217;t
use programmatic Java stubs outside of our tests, I use the &lt;code&gt;wiremock/mappings&lt;/code&gt;
folder to define our static routes for the standalone server.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;A mapping file (&lt;code&gt;wiremock/mappings/get_directory_users.json&lt;/code&gt;) looks like this:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-json hljs&#34; data-lang=&#34;json&#34;&gt;{
  &#34;request&#34;: {
    &#34;method&#34;: &#34;GET&#34;,
    &#34;urlPattern&#34;: &#34;/admin/directory/v1/users.*&#34;
  },
  &#34;response&#34;: {
    &#34;status&#34;: 200,
    &#34;headers&#34;: { &#34;Content-Type&#34;: &#34;application/json&#34; },
    &#34;bodyFileName&#34;: &#34;google_list_users.json&#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I can now spin up a standalone WireMock server using Docker Compose, mounting both
our static mappings and the shared payloads:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-yaml hljs&#34; data-lang=&#34;yaml&#34;&gt;services:
  google-api-mock:
    image: wiremock/wiremock:3x
    container_name: google-api-mock
    ports:
      - &#34;8081:8080&#34;
    volumes:
      - ./wiremock/mappings:/home/wiremock/mappings
      - ./src/test/resources/__files:/home/wiremock/__files
    command:
      - &#34;--global-response-templating&#34;
    restart: unless-stopped&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In your &lt;code&gt;application-dev.yaml&lt;/code&gt;, you hardcode the API base URL to point to the
exposed Docker port:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-yaml hljs&#34; data-lang=&#34;yaml&#34;&gt;google:
  base-url: http://localhost:8081/&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;&lt;strong&gt;Bypassing credentials locally&lt;/strong&gt;
If you use the official Google Java Client libraries (e.g.,
&lt;code&gt;google-api-services-drive&lt;/code&gt;), the SDK expects valid OAuth2 credentials or a Service
Account JSON file. If you try to run this locally without real keys, the application
crashes before it even attempts to make an HTTP request to WireMock.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I use a Spring Profile (&lt;code&gt;@Profile(&#34;dev&#34;)&lt;/code&gt;) to inject a dummy auth manager:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;// Production Implementation
@Component
@Profile(&#34;!dev&#34;)
public class DefaultGoogleAuthManager implements GoogleAuthManager {
    @Override
    public HttpRequestInitializer getCredentialsForWorkspace(Workspace workspace) {
        // Loads real ServiceAccountCredentials from a JSON file
        return new HttpCredentialsAdapter(getRawCredentials(workspace));
    }
}

// Local / Testing Implementation
@Component
@Profile(&#34;dev&#34;)
public class GoogleAuthManagerDev implements GoogleAuthManager {
    @Override
    public HttpRequestInitializer getCredentialsForWorkspace(Workspace workspace) {
        // Returns an empty initializer. Bypasses real Google OAuth entirely.
        return request -&amp;gt; {};
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;By activating the &lt;code&gt;dev&lt;/code&gt; profile during manual testing or local development, the
Google Client will happily send requests without requiring cryptographic signatures.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Now, firing up the environment is as simple as:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;olist arabic&#34;&gt;
&lt;ol class=&#34;arabic&#34;&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;docker compose up -d&lt;/code&gt; (Starts the mock API on port 8081)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run your Spring Boot application with the &lt;code&gt;dev&lt;/code&gt; profile enabled.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;By combining WireMock and TestContainers, you can create a robust, dual-purpose
&#34;LocalStack&#34; tailored to your application&amp;#8217;s needs.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Initially, it gave me reliable tests and a fast UI development loop without sharing
auth keys and hitting Google&amp;#8217;s infrastructure. Later on, when I needed to build
retry-mechanisms for Google&amp;#8217;s API rate limits, the setup was already there to
simulate those edge cases. It requires some handcrafting JSON files up front, but
the return on investment for your development flow is a huge help.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Software Development" scheme="https://jdriven.com/blog/category/Software-Development/" />
        <category term="Testing" scheme="https://jdriven.com/blog/category/Software-Development/Testing/" />
        <category term="Spring Boot" scheme="https://jdriven.com/blog/tag/Spring-Boot/" />
        <category term="WireMock" scheme="https://jdriven.com/blog/tag/WireMock/" />
        <category term="TestContainers" scheme="https://jdriven.com/blog/tag/TestContainers/" />
        <category term="Google Workspace" scheme="https://jdriven.com/blog/tag/Google-Workspace/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/How-the-default-aspect-order-can-break-your-resilience-and-caching-strategy/</id>
        <title>How the default aspect order can break your resilience and caching strategy</title>
        <social:hashtags>#Java #SpringBoot #Retry #Resilience4j #Cache #CircuitBreaker #AOP #Coding</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/How-the-default-aspect-order-can-break-your-resilience-and-caching-strategy/"/>
        <published>2026-10-13T05:00:00.000Z</published>
        <updated>2026-10-13T05:00:00.000Z</updated>
        <author>
            <name>Fatih Yilmaz</name>
            <uri>https://jdriven.com/blog/author/fatih-yilmaz</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;While working on a Spring Boot 4 service using Java 25, I wanted to protect my external API calls as these can go down every now and then.
For this I used Resilience4j &lt;code&gt;@CircuitBreaker&lt;/code&gt; and &lt;code&gt;@Retry&lt;/code&gt; annotations, and put a &lt;code&gt;@Cacheable&lt;/code&gt; on top.
Three annotations stacked on a single method, what could possibly go wrong?&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;It turns out that the order in which they are applied by default is probably not the one you want.
This makes your circuit breaker count every retry attempt as a separate failure.
And once the circuit opens it even blocks data that is sitting right there in your cache.
Here is what happens by default, and how I changed it.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;While working on a Spring Boot 4 service using Java 25, I wanted to protect my external API calls as these can go down every now and then.
For this I used Resilience4j &lt;code&gt;@CircuitBreaker&lt;/code&gt; and &lt;code&gt;@Retry&lt;/code&gt; annotations, and put a &lt;code&gt;@Cacheable&lt;/code&gt; on top.
Three annotations stacked on a single method, what could possibly go wrong?&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;It turns out that the order in which they are applied by default is probably not the one you want.
This makes your circuit breaker count every retry attempt as a separate failure.
And once the circuit opens it even blocks data that is sitting right there in your cache.
Here is what happens by default, and how I changed it.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Three annotations, one method&lt;/h3&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;@Cacheable(&#34;products&#34;)
@Retry(name = &#34;externalApi&#34;)
@CircuitBreaker(name = &#34;externalApi&#34;)
public ProductDto getProduct(String id) {
    // RestClient call to the external API
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Each annotation is handled by a Spring AOP aspect that wraps your method call.
You can think of this like the layers of an onion.
A call goes through the layers from the outside in, until it reaches your method.
The result (or exception) then travels back out through those same layers in reverse order.
The order of the annotations in your Java source code has zero impact on this wrapping.
Instead, the &lt;code&gt;order&lt;/code&gt; value of each aspect decides which layer is on the outside.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The default order&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The &lt;a href=&#34;https://resilience4j.readme.io/docs/getting-started-3#aspect-order&#34;&gt;Resilience4j documentation&lt;/a&gt; describes its default order:
&lt;code&gt;Retry ( CircuitBreaker ( RateLimiter ( TimeLimiter ( Bulkhead ( Function ) ) ) ) )&lt;/code&gt;.
What it does not tell you is where Spring&amp;#8217;s &lt;code&gt;@Cacheable&lt;/code&gt; ends up.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Out of the box, these are the order values (lower value means an outer layer):&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-none hljs&#34;&gt;Retry           LOWEST_PRECEDENCE - 5   (outside)
CircuitBreaker  LOWEST_PRECEDENCE - 4
Cache           LOWEST_PRECEDENCE       (inside)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The cache ends up on the inside because &lt;code&gt;@EnableCaching&lt;/code&gt; uses &lt;code&gt;Ordered.LOWEST_PRECEDENCE&lt;/code&gt; by default.
So your call is wrapped like this:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-none hljs&#34;&gt;Retry( CircuitBreaker( Cache( getProduct() ) ) )&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;That has some side effects I didn&amp;#8217;t like:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Every retry attempt goes through the circuit breaker.
One failing request with 3 attempts counts as 3 failed calls.
This means the circuit opens a lot sooner than you might expect.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;An open circuit throws a &lt;code&gt;CallNotPermittedException&lt;/code&gt;.
The retry sits on the outside, so it catches that exception.
With the default retry config, which retries on every exception, it waits and tries again while the circuit is still open.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When the circuit is open, the call never reaches the cache.
Data that is perfectly available in memory is not served.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The order I wanted&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I wanted the cache on the outside, then the circuit breaker, and the retry closest to the actual HTTP call:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-none hljs&#34;&gt;Cache( CircuitBreaker( Retry( getProduct() ) ) )&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;That takes three settings:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-properties hljs&#34; data-lang=&#34;properties&#34;&gt;resilience4j.circuitbreaker.circuit-breaker-aspect-order=1
resilience4j.retry.retry-aspect-order=2&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;@Configuration
@EnableCaching(order = 0)
public class CacheConfig {
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The Resilience4j docs say that a higher value means a higher priority.
That &#34;priority&#34; means the aspect sits &lt;em&gt;closer to your method&lt;/em&gt; (on the inside), not that it runs first (on the outside).&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;With this order:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A cache hit is returned straight away, even when the circuit is open.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The retry does all its attempts first.
Only when the last one fails does the circuit breaker record a single failure, so the failure rate is based on requests, not attempts.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;An open circuit rejects the call before the retry even starts, so there is no pointless waiting.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Stacking resilience and caching annotations is easy, but relying on their default aspect order can quietly break your strategy.
So write the order you want down explicitly in your configuration and back it up with tests.
The next developer reading your code will thank you.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Java" scheme="https://jdriven.com/blog/category/Java/" />
        <category term="Software Development" scheme="https://jdriven.com/blog/category/Java/Software-Development/" />
        <category term="Java" scheme="https://jdriven.com/blog/tag/Java/" />
        <category term="Spring Boot" scheme="https://jdriven.com/blog/tag/Spring-Boot/" />
        <category term="Retry" scheme="https://jdriven.com/blog/tag/Retry/" />
        <category term="Resilience4j" scheme="https://jdriven.com/blog/tag/Resilience4j/" />
        <category term="Cache" scheme="https://jdriven.com/blog/tag/Cache/" />
        <category term="Circuit Breaker" scheme="https://jdriven.com/blog/tag/Circuit-Breaker/" />
        <category term="AOP" scheme="https://jdriven.com/blog/tag/AOP/" />
        <category term="Coding" scheme="https://jdriven.com/blog/tag/Coding/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/intellij-debug-lombok-requiredargsconstructor/</id>
        <title>IntelliJ IDEA: Use Breakpoints Debugging Lombok Constructor Annotations</title>
        <social:hashtags>#IntelliJIDEA #Debugging</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/intellij-debug-lombok-requiredargsconstructor/"/>
        <published>2026-10-12T02:33:55.000Z</published>
        <updated>2026-10-12T02:33:55.000Z</updated>
        <author>
            <name>mrhaki</name>
            <social:mastodon>mrhaki@mastodon.online</social:mastodon>
            <social:bluesky>mrhaki.com</social:bluesky>
            <uri>https://jdriven.com/blog/author/mrhaki</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;As a consultant I am part of a lot of different Java projects.
Some of these project use Lombok.
When you use a Lombok annotation code gets generated when the code is compiled.
This code is not visible in the IntelliJ IDEA editor which could be a problem when you want to debug your application and need to add a breakpoint for the generated code.
Suppose you have a Java class with a simple constructor without using Lombok annotations.
You can place a breakpoint in the constructor and when you debug the application in IntelliJ IDEA the execution stops at the breakpoint.
Now you can check for example the values of parameters that are passed into the constructor call.
But when you use a Lombok annotation like &lt;code&gt;@RequiredArgsConstructor&lt;/code&gt; the code for the constructor is generated and not visible in your editor.
If you want to check the values of parameters passed into the constructor you need to set a breakpoint at the line that has the &lt;code&gt;@RequiredArgsConstructor&lt;/code&gt; statement.
When you debug your application IntelliJ IDEA will stop execution when the constructor is invoked and you can check values of parameters.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;As a consultant I am part of a lot of different Java projects.
Some of these project use Lombok.
When you use a Lombok annotation code gets generated when the code is compiled.
This code is not visible in the IntelliJ IDEA editor which could be a problem when you want to debug your application and need to add a breakpoint for the generated code.
Suppose you have a Java class with a simple constructor without using Lombok annotations.
You can place a breakpoint in the constructor and when you debug the application in IntelliJ IDEA the execution stops at the breakpoint.
Now you can check for example the values of parameters that are passed into the constructor call.
But when you use a Lombok annotation like &lt;code&gt;@RequiredArgsConstructor&lt;/code&gt; the code for the constructor is generated and not visible in your editor.
If you want to check the values of parameters passed into the constructor you need to set a breakpoint at the line that has the &lt;code&gt;@RequiredArgsConstructor&lt;/code&gt; statement.
When you debug your application IntelliJ IDEA will stop execution when the constructor is invoked and you can check values of parameters.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The following example shows first a Java class with a constructor in the code:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package mrhaki.blog;

public class UserContext {
  private final UserProvider userProvider;

  public UserContext(UserProvider userProvider) {
    this.userProvider = userProvider; // Add breakpoint on this line
  }

  String getName() {
    return userProvider.getId();
  }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;It is easy to set the breakpoint as you have all the source code:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;imageblock text-center&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;/blog/uploads/2026/10/intellij-idea-breakpoint-constructor.png&#34; alt=&#34;Set breakpoint in constructor defined in code&#34;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Now suppose you use Lombok and instead of writing the constructor in the code you use the &lt;code&gt;@RequiredArgsConstructor&lt;/code&gt; Lombok annotation:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package mrhaki.blog;

import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor // Add breakpoint on this line
public class UserContext {
  private final UserProvider userProvider;

  String getName() {
    return userProvider.getId();
  }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The compiled class file will have the constructor code just as you would have written it yourself.
In order to set a breakpoint you simply place it on the line of the annotation:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;imageblock text-center&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;/blog/uploads/2026/10/intellij-idea-breakpoint-lombok.png&#34; alt=&#34;Set breakpoint at line of Lombok annotation&#34;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Running the application in debug mode will stop execution at the generated constructor code and allows you to check the value of the constructor argument that is used:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;imageblock text-center&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;/blog/uploads/2026/10/intellij-idea-debug-view.png&#34; alt=&#34;Stop execution of application and see values constructor arguments&#34;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;To be able to set breakpoints even when Lombok annotations are used can be very useful.
For example to check if Spring components are created with values that you expect.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Written with Intellij IDEA 2026.2.3.&lt;/p&gt;
&lt;/div&gt;</content>
        <category term="IntelliJ IDEA" scheme="https://jdriven.com/blog/category/IntelliJ-IDEA/" />
        <category term="IntelliJ IDEA" scheme="https://jdriven.com/blog/tag/IntelliJ-IDEA/" />
        <category term="Debugging" scheme="https://jdriven.com/blog/tag/Debugging/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/The-Azure-Scale-Controller-is-Wilding-Build-Your-Own-Java-Fan-Out-Orchestrator/</id>
        <title>The Azure Scale Controller is Wilding: Build Your Own Java Fan-Out Orchestrator</title>
        <social:hashtags>#Java #Concurrency #AzureFunctions #Serverless #AzureDurableFunctions #DesignPatterns #Throttling</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/The-Azure-Scale-Controller-is-Wilding-Build-Your-Own-Java-Fan-Out-Orchestrator/"/>
        <published>2026-10-09T05:00:00.000Z</published>
        <updated>2026-10-09T05:00:00.000Z</updated>
        <author>
            <name>Tundzaj Barov</name>
            <uri>https://jdriven.com/blog/author/tundzaj-barov</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;If you work with Azure Durable Functions, you likely use the Fan-Out / Fan-In pattern to process data in parallel. In practice, trusting default queue scaling in production often triggers HTTP 429 (Too Many Requests) storms, connection pool exhaustion, and downstream outages.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;If you work with Azure Durable Functions, you likely use the Fan-Out / Fan-In pattern to process data in parallel. In practice, trusting default queue scaling in production often triggers HTTP 429 (Too Many Requests) storms, connection pool exhaustion, and downstream outages.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The Problem: Aggressive Autoscaling&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Queues decouple workloads, but they don&amp;#8217;t rate-limit them.
When an orchestrator dumps thousands of task messages into an Azure Storage Queue within milliseconds, the Scale Controller sees a spike and panics—rapidly spinning up worker instances to clear the backlog.
Those workers instantly bombard your downstream databases, legacy systems, or third-party APIs with hundreds of parallel requests, crushing infrastructure under its own weight.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Why Global Settings Fall Short&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Setting static concurrency caps in host.json or setting instance limits in the Azure Portal creates major trade-offs:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;olist arabic&#34;&gt;
&lt;ol class=&#34;arabic&#34;&gt;
&lt;li&gt;
&lt;p&gt;host.json Limits Are Global: A static concurrency limit applies to all activity functions in the app. Lightweight logging and heavy database writes get choked equally.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Instance Caps Affect Every Trigger: Restricting scale-out caps HTTP endpoints or Service Bus triggers running in the same app.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The Data Engineer&amp;#8217;s Dilemma: Data pipelines consume from different data sources with different capacities:&lt;/p&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Legacy Relational DB: Fails above 5 concurrent connections.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;SaaS REST API: Rate-limits above 20 requests/second.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Cloud Blob Storage: Handles 100+ parallel streams with ease.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The Solution: The Sliding Window Pattern&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Instead of letting Azure&amp;#8217;s autoscaler take over, control execution speed directly inside your Java Orchestrator.
Using a Sliding Window pattern, you maintain a fixed worker pool size per batch run. As soon as one task finishes, the orchestrator immediately spawns the next item.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Code Implementation&lt;/h3&gt;
&lt;div class=&#34;olist arabic&#34;&gt;
&lt;ol class=&#34;arabic&#34;&gt;
&lt;li&gt;
&lt;p&gt;HTTP Starter Function
Triggers the orchestrator and returns standard status-check URLs.&lt;/p&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package com.example;

import com.microsoft.azure.functions.ExecutionContext;
import com.microsoft.azure.functions.HttpMethod;
import com.microsoft.azure.functions.HttpRequestMessage;
import com.microsoft.azure.functions.HttpResponseMessage;
import com.microsoft.azure.functions.annotation.AuthorizationLevel;
import com.microsoft.azure.functions.annotation.FunctionName;
import com.microsoft.azure.functions.annotation.HttpTrigger;
import com.microsoft.durabletask.DurableTaskClient;
import com.microsoft.durabletask.azurefunctions.DurableClientContext;
import com.microsoft.durabletask.azurefunctions.DurableClientInput;

import java.util.Optional;

public class StartOrchestrationFunction {

    @FunctionName(&#34;start-fan-out&#34;)
    public HttpResponseMessage start(
            @HttpTrigger(
                    name = &#34;req&#34;,
                    methods = {HttpMethod.POST},
                    authLevel = AuthorizationLevel.ANONYMOUS)
            HttpRequestMessage&amp;lt;Optional&amp;lt;String&amp;gt;&amp;gt; request,
            @DurableClientInput(name = &#34;durableContext&#34;) DurableClientContext durableContext,
            final ExecutionContext context) {

        DurableTaskClient client = durableContext.getClient();

        String instanceId = client.scheduleNewOrchestrationInstance(&#34;mini-fan-out-orchestrator&#34;);

        return durableContext.createCheckStatusResponse(request, instanceId);
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Sliding Window Orchestrator
Caps running tasks at maxConcurrency and feeds new items into the worker pool as running tasks finish.&lt;/p&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package com.example;

import com.microsoft.azure.functions.annotation.FunctionName;
import com.microsoft.durabletask.Task;
import com.microsoft.durabletask.TaskOrchestrationContext;
import com.microsoft.durabletask.azurefunctions.DurableOrchestrationTrigger;

import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Set;

public class MiniOrchestrator {

    @FunctionName(&#34;mini-fan-out-orchestrator&#34;)
    public void run(@DurableOrchestrationTrigger(name = &#34;ctx&#34;) TaskOrchestrationContext ctx) {
        int maxConcurrency = 2;
        List&amp;lt;String&amp;gt; items = List.of(&#34;Item1&#34;, &#34;Item2&#34;, &#34;Item3&#34;, &#34;Item4&#34;, &#34;Item5&#34;, &#34;Item6&#34;, &#34;Item7&#34;);

        Queue&amp;lt;String&amp;gt; remaining = new LinkedList&amp;lt;&amp;gt;(items);
        Set&amp;lt;Task&amp;lt;?&amp;gt;&amp;gt; runningTasks = new HashSet&amp;lt;&amp;gt;();

        while (runningTasks.size() &amp;lt; maxConcurrency &amp;amp;&amp;amp; !remaining.isEmpty()) {
            runningTasks.add(ctx.callActivity(&#34;process-item&#34;, remaining.poll(), Void.class));
        }

        while (!remaining.isEmpty()) {
            Task&amp;lt;?&amp;gt; completed = ctx.anyOf(runningTasks.toArray(new Task[0])).await();
            runningTasks.remove(completed);
            runningTasks.add(ctx.callActivity(&#34;process-item&#34;, remaining.poll(), Void.class));
        }

        while (!runningTasks.isEmpty()) {
            Task&amp;lt;?&amp;gt; completed = ctx.anyOf(runningTasks.toArray(new Task[0])).await();
            runningTasks.remove(completed);
        }
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Activity Function (process-item)
Executes the discrete unit of work against your target system.&lt;/p&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;package com.example;

import com.microsoft.azure.functions.ExecutionContext;
import com.microsoft.azure.functions.annotation.FunctionName;
import com.microsoft.durabletask.azurefunctions.DurableActivityTrigger;

public class ProcessItemActivity {
    @FunctionName(&#34;process-item&#34;)
    public void processItem(
            @DurableActivityTrigger(name = &#34;item&#34;) String item,
            final ExecutionContext context) {

        context.getLogger().info(&#34;Processing batch item: &#34; + item);

        // Simulate database or API work
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
        context.getLogger().info(&#34;Successfully processed: &#34; + item);
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Global host settings and infrastructure scale limits are blunt tools that treat every function identically. By controlling concurrency directly inside your Java orchestrator with a sliding window, you gain fine-grained execution limits tailored to each downstream target. This pattern protects fragile dependencies from HTTP 429 errors and connection pool exhaustion, transforming unpredictable cloud autoscaling into a controlled, production-ready pipeline.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Azure Functions" scheme="https://jdriven.com/blog/category/Azure-Functions/" />
        <category term="Serverless" scheme="https://jdriven.com/blog/category/Azure-Functions/Serverless/" />
        <category term="Azure Durable Functions" scheme="https://jdriven.com/blog/category/Azure-Functions/Serverless/Azure-Durable-Functions/" />
        <category term="Cloud Architecture" scheme="https://jdriven.com/blog/category/Azure-Functions/Serverless/Azure-Durable-Functions/Cloud-Architecture/" />
        <category term="Java" scheme="https://jdriven.com/blog/tag/Java/" />
        <category term="Concurrency" scheme="https://jdriven.com/blog/tag/Concurrency/" />
        <category term="Azure Functions" scheme="https://jdriven.com/blog/tag/Azure-Functions/" />
        <category term="Serverless" scheme="https://jdriven.com/blog/tag/Serverless/" />
        <category term="Azure Durable Functions" scheme="https://jdriven.com/blog/tag/Azure-Durable-Functions/" />
        <category term="Design Patterns" scheme="https://jdriven.com/blog/tag/Design-Patterns/" />
        <category term="Throttling" scheme="https://jdriven.com/blog/tag/Throttling/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/Lets-introduce-a-NullPropagates-annotation/</id>
        <title>Let&#39;s introduce a @NullPropagates annotation</title>
        <social:hashtags>#Java #AnnotationProcessor</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/Lets-introduce-a-NullPropagates-annotation/"/>
        <published>2026-10-08T05:00:00.000Z</published>
        <updated>2026-10-08T05:00:00.000Z</updated>
        <author>
            <name>Jacob</name>
            <uri>https://jdriven.com/blog/author/jacobvlingen</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;It&amp;#8217;s finally mature: a framework to define nullability in Java.
There have been so many attempts, but JSpecify is here to stay.
Now that this has been addressed, another challenge comes to mind:
How can we eliminate the boilerplate of handling incoming &lt;code&gt;null&lt;/code&gt; arguments?&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;It&amp;#8217;s finally mature: a framework to define nullability in Java.
There have been so many attempts, but JSpecify is here to stay.
Now that this has been addressed, another challenge comes to mind:
How can we eliminate the boilerplate of handling incoming &lt;code&gt;null&lt;/code&gt; arguments?&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;With the rise of a proper nullability type system, there&amp;#8217;s less need to use the &lt;code&gt;Optional&lt;/code&gt; type.
For example, one might write a null-safe method to uppercase a string value, like this:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;public static @Nullable String upper(@Nullable String value) {
    if (value == null) {
        return null;
    }
    return value.toUpperCase();
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Such a method either returns &lt;code&gt;null&lt;/code&gt; or returns the value in uppercase.
This pattern is commonly used, especially for utility functions where you don&amp;#8217;t control the caller side&lt;sup class=&#34;footnote&#34;&gt;[&lt;a id=&#34;_footnoteref_1&#34; class=&#34;footnote&#34; href=&#34;#_footnotedef_1&#34; title=&#34;View footnote.&#34;&gt;1&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;When I found myself writing more and more of these methods, I came to the conclusion I needed an annotation to get rid of the boilerplate.
Naturally, I checked if the Lombok project had something for this, but sadly there was no annotation that fit my needs&lt;sup class=&#34;footnote&#34;&gt;[&lt;a id=&#34;_footnoteref_2&#34; class=&#34;footnote&#34; href=&#34;#_footnotedef_2&#34; title=&#34;View footnote.&#34;&gt;2&lt;/a&gt;]&lt;/sup&gt;.
The thing that came closest was the &lt;code&gt;@NonNull&lt;/code&gt; annotation, which turns:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;public static String upper(@NonNull String value) {
    return value.toUpperCase();
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;into:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;public static String upper(@NonNull String value) {
    if (value == null) {
        throw new NullPointerException(&#34;value is marked non-null but is null&#34;);
    }
    return value.toUpperCase();
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;This was almost exactly what I wanted, except it needed to return &lt;code&gt;null&lt;/code&gt; instead of throwing an exception.
Luckily, I had already started a project to learn how Lombok modifies the &lt;a href=&#34;https://en.wikipedia.org/wiki/Abstract_syntax_tree&#34;&gt;AST&lt;/a&gt; with an annotation processor, so I knew how to do it myself&lt;sup class=&#34;footnote&#34;&gt;[&lt;a id=&#34;_footnoteref_3&#34; class=&#34;footnote&#34; href=&#34;#_footnotedef_3&#34; title=&#34;View footnote.&#34;&gt;3&lt;/a&gt;]&lt;/sup&gt;.
It turned out not to be that hard at all!&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;We can start by defining an annotation that indicates a &lt;a href=&#34;https://stackoverflow.com/questions/27494316/what-is-a-formal-parameter-in-java&#34;&gt;formal parameter&lt;/a&gt; declaration should cause the enclosing method to return &lt;code&gt;null&lt;/code&gt; whenever the argument is &lt;code&gt;null&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.SOURCE)
public @interface NullPropagates {
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Next, we create the processor boilerplate:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;@SupportedSourceVersion(RELEASE_21)
@SupportedAnnotationTypes(&#34;org.jdriven.NullPropagates&#34;)
public class NullPropagatesProcessor extends AbstractProcessor {
    private Trees treeUtils;      // query information from the AST
    private TreeMaker treeMaker;  // create and modify AST elements

    @Override
    public synchronized void init(ProcessingEnvironment processingEnv) {
        super.init(processingEnv);
        this.treeUtils = instance(processingEnv);
        this.treeMaker = TreeMaker.instance(((JavacProcessingEnvironment) processingEnv).getContext());
    }

    @Override
    public boolean process(Set&amp;lt;? extends TypeElement&amp;gt; annotations, RoundEnvironment roundEnv) {
        roundEnv.getElementsAnnotatedWith(NullPropagates.class).stream()
                .forEach( /* do something */ );

        return true;
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Now for the actual implementation.
Because our annotation targets only &lt;code&gt;ElementType.PARAMETER&lt;/code&gt;, we know it can only be placed on method and constructor parameters.
When processing the annotations, we simply group the annotated parameters by their enclosing method and add null checks at the beginning of each method body.
That&amp;#8217;s as easy as:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;public boolean process(Set&amp;lt;? extends TypeElement&amp;gt; annotations, RoundEnvironment roundEnv) {
    roundEnv.getElementsAnnotatedWith(NullPropagates.class).stream()
                // The enclosing element of a parameter is its method or constructor.
                .collect(groupingBy(it -&amp;gt; it.getEnclosingElement(), mapping(Function.identity(), toSet())))
                // At this point, each method/constructor is mapped to its @NullPropagates parameters
                .forEach(this::addNullChecks);

    return true;
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;To generate an &lt;code&gt;if&lt;/code&gt; block like:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;if (&amp;lt;paramName&amp;gt; == null) {
    return null;
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;we can use &lt;code&gt;treeMaker&lt;/code&gt; to generate the AST elements:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;private JCStatement nullCheck(JCVariableDecl parameter) {
    // Reassign current position to parameter position
    treeMaker.at(parameter.pos);
    // `&amp;lt;paramName&amp;gt; == null`
    var isNull = treeMaker.Binary(EQ, treeMaker.Ident(parameter.getName()), treeMaker.Literal(BOT, null));
    // `return null`
    var returnNull = treeMaker.Return(treeMaker.Literal(BOT, null));
    // { &amp;lt;returnNull&amp;gt; }
    var returnNullBlock = treeMaker.Block(0, of(returnNull));

    // if ( &amp;lt;isNull&amp;gt; ) { &amp;lt;returnNull&amp;gt; }
    return treeMaker.If(isNull, returnNullBlock, null);
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;All that&amp;#8217;s left now is to connect the dots:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;private void addNullChecks(ExecutableElement method, Set&amp;lt;? extends Element&amp;gt; annotatedParameters) {
    var nullChecks = annotatedParameters.stream()
             // Map each parameter to the javac internal representation
            .map(it -&amp;gt; (JCVariableDecl) treeUtils.getTree(it))
            // ... and create a nullCheck statement
            .map(this::nullCheck)
            .toList();

    // Use the javac internal method representation to add the statements to the method body
    var methodDecl = (JCMethodDecl) treeUtils.getTree(method);
    methodDecl.body.stats = from(nullChecks).appendList(methodDecl.body.stats);
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;And that&amp;#8217;s it!
Now we can use the annotation as desired:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;public static @Nullable String upper(@NullPropagates String value) {
    return value.toUpperCase();
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;And the annotation processor will turn it into:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlightjs highlight&#34;&gt;&lt;code class=&#34;language-java hljs&#34; data-lang=&#34;java&#34;&gt;public static @Nullable String upper(@NullPropagates String value) {
    if (value == null) {
        return null;
    }
    return value.toUpperCase();
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;For a production-ready implementation, we would need to add a few guards: for instance, methods returning &lt;code&gt;void&lt;/code&gt;, methods with primitive return types, or primitive parameters should be ignored or flagged with a compiler error.
Constructors should also be skipped, because they do not return anything&lt;sup class=&#34;footnote&#34;&gt;[&lt;a id=&#34;_footnoteref_4&#34; class=&#34;footnote&#34; href=&#34;#_footnotedef_4&#34; title=&#34;View footnote.&#34;&gt;4&lt;/a&gt;]&lt;/sup&gt;!
Adding these guards is a straightforward addition to the core logic shown here.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;You can check out the full implementation on GitHub: &lt;a href=&#34;https://github.com/jevanlingen/try-annotation-processor/blob/main/src/processor/java/org/jdriven/NullPropagatesProcessor.java&#34;&gt;NullPropagatesProcessor.java&lt;/a&gt;.&lt;br&gt;
Happy coding!&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;footnotes&#34;&gt;
&lt;hr&gt;
&lt;div class=&#34;footnote&#34; id=&#34;_footnotedef_1&#34;&gt;
&lt;a href=&#34;#_footnoteref_1&#34;&gt;1&lt;/a&gt;. See, for example, the &lt;a href=&#34;https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html&#34;&gt;API&lt;/a&gt; of the &lt;code&gt;StringUtils&lt;/code&gt; class from the Apache Commons project
&lt;/div&gt;
&lt;div class=&#34;footnote&#34; id=&#34;_footnotedef_2&#34;&gt;
&lt;a href=&#34;#_footnoteref_2&#34;&gt;2&lt;/a&gt;. Interestingly, years ago there was a &lt;a href=&#34;https://github.com/projectlombok/lombok/issues/1552&#34;&gt;feature request&lt;/a&gt; to introduce a &lt;code&gt;@ReturnNull&lt;/code&gt; annotation, whose intended behavior was literally what I am proposing here. The request was rejected because it could lead to null pointer exceptions in unexpected places. That may have been true back in 2018, but now that we have a sound nullability system, I don&amp;#8217;t really agree with that premise.
&lt;/div&gt;
&lt;div class=&#34;footnote&#34; id=&#34;_footnotedef_3&#34;&gt;
&lt;a href=&#34;#_footnoteref_3&#34;&gt;3&lt;/a&gt;. There are already many great blog posts out there explaining how annotation processors work. If you are new to the topic, &lt;a href=&#34;https://hannesdorfmann.com/annotation-processing/annotationprocessing101/&#34;&gt;Annotation Processing 101&lt;/a&gt; by Hannes Dorfmann is a great starting point. Annotation processors are officially meant for generating new code, but by tapping into compiler internals, which is Lombok&amp;#8217;s core trick, you can also modify the AST.
&lt;/div&gt;
&lt;div class=&#34;footnote&#34; id=&#34;_footnotedef_4&#34;&gt;
&lt;a href=&#34;#_footnoteref_4&#34;&gt;4&lt;/a&gt;. Which conveniently spares us the headache in older Java versions where statements cannot precede a &lt;code&gt;super(&amp;#8230;&amp;#8203;)&lt;/code&gt; or &lt;code&gt;this(&amp;#8230;&amp;#8203;)&lt;/code&gt; invocation. Starting with Java 25, &lt;a href=&#34;https://openjdk.org/jeps/513&#34;&gt;JEP 513: Flexible Constructor Bodies&lt;/a&gt; was released to address this issue.
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Coding" scheme="https://jdriven.com/blog/category/Coding/" />
        <category term="Nullable" scheme="https://jdriven.com/blog/category/Coding/Nullable/" />
        <category term="Java" scheme="https://jdriven.com/blog/tag/Java/" />
        <category term="Annotation Processor" scheme="https://jdriven.com/blog/tag/Annotation-Processor/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/bitter-lesson/</id>
        <title>Learning the Bitter Lesson</title>
        <social:hashtags>#AI</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/bitter-lesson/"/>
        <published>2026-10-07T07:00:00.000Z</published>
        <updated>2026-10-07T07:00:00.000Z</updated>
        <author>
            <name>Casper</name>
            <uri>https://jdriven.com/blog/author/carooker</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Our colleague Jacob shed a light on working with AI in a post he wrote back in June, &lt;a href=&#34;https://jdriven.com/blog/2026/06/Contemplations&#34;&gt;Contemplations&lt;/a&gt;. One of his points was that, with AI being more and more ubiquitous in our work as software developers, sophisticated programming concepts are starting to become irrelevant. The AI doesn&amp;#8217;t care how elegant the code is, it spits out something that works. In the end that&amp;#8217;s what matters to the business; it just works.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I learned about Rich Sutton&amp;#8217;s &lt;a href=&#34;http://www.incompleteideas.net/IncIdeas/BitterLesson.html&#34;&gt;&#34;Bitter Lesson&#34;&lt;/a&gt; recently, and I can&amp;#8217;t help but draw parallels between the work on the cutting edge he describes and our daily work using AI as software engineers.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Our colleague Jacob shed a light on working with AI in a post he wrote back in June, &lt;a href=&#34;https://jdriven.com/blog/2026/06/Contemplations&#34;&gt;Contemplations&lt;/a&gt;. One of his points was that, with AI being more and more ubiquitous in our work as software developers, sophisticated programming concepts are starting to become irrelevant. The AI doesn&amp;#8217;t care how elegant the code is, it spits out something that works. In the end that&amp;#8217;s what matters to the business; it just works.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I learned about Rich Sutton&amp;#8217;s &lt;a href=&#34;http://www.incompleteideas.net/IncIdeas/BitterLesson.html&#34;&gt;&#34;Bitter Lesson&#34;&lt;/a&gt; recently, and I can&amp;#8217;t help but draw parallels between the work on the cutting edge he describes and our daily work using AI as software engineers.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;What is the &#34;Bitter Lesson&#34;?&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In summary, Sutton describes the Bitter Lesson as our persistence of designing systems by leveraging our human knowledge in a given domain, while the abundance of available computation power ultimately makes generic, computationally intensive solutions more effective. He calls this lesson bitter because it goes against our intuition and our desire to build systems that incorporate our knowledge and understanding of the world.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;He identifies two general purpose methods that have proven to be much more effective than any alternative that leverages human knowledge: searching and learning. Our minds are very complex, as they reflect the outside world which is intrinsically complex. Sutton argues it is more effective to focus on using these &#34;meta-methods&#34; that can capture complexity, rather than encode human knowledge in the solution. His bottom line is that we should strive to develop agents that discover in the same way humans can.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;How does the Bitter Lesson reflect on our daily work as software engineers?&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;As software engineers, we are tasked with building, but more importantly, understanding software. I think the Bitter Lesson can give us opportunities to be more effective by decreasing necessity of having to learn existing domain knowledge and having to develop a deep understanding for it, and instead focus more on understanding more abstract and generic methods that leverage computation. What do I mean with that? Let&amp;#8217;s use an example. Say you are building a system that needs to process a large amount of data. You could spend a lot of time learning about the specific domain and the best ways to process that data, or you could focus on developing a general method that can process any kind of data efficiently. By focusing on the general method, you can leverage computation to solve the problem more effectively.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;As using AI to produce software is already making us many times more productive in terms of LOC, the price of every line has already dropped significantly. I would argue that the bitter lesson is just another argument to face this new reality. Where spending a lot of effort in making a piece of elegant code is just not worth the effort. At least not compared to letting the AI make a piece of generic code that does the job just as effectively, even if it is more computationally intensive.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In conclusion, I think the Bitter Lesson is an argument that we shouldn&amp;#8217;t strive to encode human knowledge into a system when our time might be better spent on understanding and building these &#34;meta-methods&#34; that can capture complexity.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="AI" scheme="https://jdriven.com/blog/category/AI/" />
        <category term="Software Development" scheme="https://jdriven.com/blog/category/AI/Software-Development/" />
        <category term="AI" scheme="https://jdriven.com/blog/tag/AI/" />
    </entry>
    <entry>
        <id>https://jdriven.com/blog/2026/10/learning-by-steering-building-software-by-using-AI-webclient/</id>
        <title>Learning by steering: building software by using AI webclient as a pair programmer</title>
        <social:hashtags>#SpringBoot #Gemini #HexagonalArchitecture #HTMX</social:hashtags>
        <link rel="alternate" href="https://jdriven.com/blog/2026/10/learning-by-steering-building-software-by-using-AI-webclient/"/>
        <published>2026-10-06T08:30:00.000Z</published>
        <updated>2026-10-06T08:30:00.000Z</updated>
        <author>
            <name>Arjen</name>
            <social:twitter>tebbenhof</social:twitter>
            <social:mastodon>tebbenhof@mastodon.social</social:mastodon>
            <social:bluesky>arjen.tebbenhof.nl</social:bluesky>
            <uri>https://jdriven.com/blog/author/arjen-tebbenhof</uri>
        </author>
        <summary type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Over the past few weeks, I’ve been on a rewarding journey.
As a Managing Director who is no longer a full-time software developer,
finding the time to code and keep up with the relentless pace of new
technologies is a real challenge. While my colleagues are experimenting
with the latest frameworks and tools daily, I know I&amp;#8217;m not alone in
feeling that the tech landscape evolves faster than the hours in a
day allow — or faster than what client projects typically permit you
to explore.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;That&amp;#8217;s why I cherish internal projects. Earlier this year I posted about
&lt;a href=&#34;/blog/2026/01/Posting-our-blog-feed-to-social-networks-using-Slack&#34;&gt;Posting
our blog feed to social networks using Slack&lt;/a&gt;. And recently I set out
to build a couple of internal tools for our Google Workspace
environments, but I decided to try something different than what
maybe most developers would do.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Instead of relying solely on traditional documentation or enabling
an autopilot AI assistant directly inside my IDE or terminal
(like a Claude Code subscription), I used the standard Google
Gemini web client. It comes included with our company&amp;#8217;s Google
Workspace account — proving that you don&amp;#8217;t need expensive
premium subscriptions or complex local LLMs to get value.&lt;/p&gt;
&lt;/div&gt;</summary>
        <content type="html">&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Over the past few weeks, I’ve been on a rewarding journey.
As a Managing Director who is no longer a full-time software developer,
finding the time to code and keep up with the relentless pace of new
technologies is a real challenge. While my colleagues are experimenting
with the latest frameworks and tools daily, I know I&amp;#8217;m not alone in
feeling that the tech landscape evolves faster than the hours in a
day allow — or faster than what client projects typically permit you
to explore.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;That&amp;#8217;s why I cherish internal projects. Earlier this year I posted about
&lt;a href=&#34;/blog/2026/01/Posting-our-blog-feed-to-social-networks-using-Slack&#34;&gt;Posting
our blog feed to social networks using Slack&lt;/a&gt;. And recently I set out
to build a couple of internal tools for our Google Workspace
environments, but I decided to try something different than what
maybe most developers would do.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Instead of relying solely on traditional documentation or enabling
an autopilot AI assistant directly inside my IDE or terminal
(like a Claude Code subscription), I used the standard Google
Gemini web client. It comes included with our company&amp;#8217;s Google
Workspace account — proving that you don&amp;#8217;t need expensive
premium subscriptions or complex local LLMs to get value.&lt;/p&gt;
&lt;/div&gt;
&lt;span id=&#34;more&#34;&gt;&lt;/span&gt;
&lt;div class=&#34;imageblock text-center&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;/blog/uploads/2026/10/learning-by-steering-desk.jpg&#34; alt=&#34;learning by steering desk&#34; width=&#34;50%&#34;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;My goal wasn&amp;#8217;t just to generate code quickly. I wanted to dump
codebases into the chat, ask the AI &lt;strong&gt;why&lt;/strong&gt; it made specific choices,
challenge those choices, and effectively use it as an interactive
sparring partner. I wanted to stay in the driver&amp;#8217;s seat.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;This conscious, deliberate approach surprisingly taught me a lot
about technologies I hadn&amp;#8217;t used extensively before. Here is what
I learned along the way.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Two projects, one learning curve&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;To give you some context, I built two distinct Spring Boot
applications using Java 25 and a Hexagonal Architecture (Ports and
Adapters):&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;olist arabic&#34;&gt;
&lt;ol class=&#34;arabic&#34;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Google Workspace Multi-Directory Hub:&lt;/strong&gt; A web application that
synchronizes user directories across four independent Google
Workspaces. It ensures that everyone in our company has a complete,
up-to-date address book on their phone and in Gmail, utilizing the
legacy Google Shared Contacts XML API.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Drive Audit CLI:&lt;/strong&gt; A lightweight console application that
scans Shared Drives across our workspaces to detect explicit
permission overrides (e.g., external &lt;code&gt;@gmail.com&lt;/code&gt; accounts
accessing internal documents) and exports the findings to Google
Sheets.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I actually only planned to build the first one. But because the
learning process with the AI was so effective and enjoyable
(&lt;a href=&#34;/blog/2026/08/justonemoreprompt&#34;&gt;just one more prompt&lt;/a&gt;),
I wanted to experience that &#34;learning high&#34; again. That&amp;#8217;s why I
started the CLI tool when the opportunity came along.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Steering the AI: the architect&amp;#8217;s dilemma&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;One of my biggest takeaways was that while AI is incredibly
powerful at writing boilerplate or explaining complex APIs, it
doesn&amp;#8217;t naturally care about your architecture.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I specifically wanted to use Hexagonal Architecture to isolate
my domain logic from the Google API infrastructure. Time and time
again, the AI would suggest quick-and-dirty fixes that violated
this principle. It would try to leak API-specific DTOs into the
domain layer or suggest tightly coupled solutions that ignored
the DRY (Don&amp;#8217;t Repeat Yourself) or YAGNI (You Ain&amp;#8217;t Gonna Need
It) principles.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Because I was using a web client and not an auto-commit agent, I
was forced to read the code, recognize the architectural violations,
and push back. &lt;strong&gt;&#34;Why are you doing it this way? That breaks the
port interface,&#34;&lt;/strong&gt; I would type.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Instead of reducing my role to a mere &#34;code reviewer&#34; — a common
fear in today&amp;#8217;s AI discourse — this friction sparked a powerful
synergy. I brought my software engineering experience and
architectural vision (knowing &lt;strong&gt;what&lt;/strong&gt; works in the long run), while
the AI provided a vast wealth of technical details and API
knowledge I hadn&amp;#8217;t yet acquired (the &lt;strong&gt;how&lt;/strong&gt;). This active dialogue
forced me to deeply internalize the rules of Hexagonal Architecture
in ways I wouldn&amp;#8217;t have achieved in such a high pace on my own.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;The &lt;code&gt;AGENTS.md&lt;/code&gt; experiment&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;During the first project, I noticed I was constantly repeating
myself to get the AI back on track architecturally. And my
colleagues were actively picking and setting up system prompts
or agent instructions (ref:
&lt;a href=&#34;/media/pages/aanbod/tech-radar/464ef2b625-1778679386/jdriven-radar-voorjaar-2026-en.pdf&#34;&gt;Agents.md&lt;/a&gt;
in our Spring 2026 TechRadar edition).&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;For the second project (the Drive Audit CLI), I decided to
formalize this. I created an &lt;code&gt;AGENTS.md&lt;/code&gt; file in the root of my
repository containing strict rules: &#34;Use Hexagonal Architecture&#34;,
&#34;No framework dependencies in the domain&#34;, &#34;Fail gracefully&#34;, and
&#34;All code and comments MUST be in English&#34; (as I wrote my prompts
in Dutch).&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I fed this file to the AI chat prompt, alongside my code dumps. It
definitely  helped to align the AI&amp;#8217;s initial output with my
architectural goals, drastically reducing the required corrections.
However, it wasn&amp;#8217;t foolproof. I still caught the AI occasionally
slipping — for instance, generating comments in Dutch despite the
explicit instruction to use English. It proved that while you can
guide the AI, you can never blindly trust it. You always remain the
lead developer.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Accelerated learning: tackling the unknown&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The biggest win of this pair-programming approach was how it
lowered the barrier to entry for technologies I wasn&amp;#8217;t fully
familiar with. Because I could ask the AI &lt;strong&gt;how&lt;/strong&gt; to configure
things and &lt;strong&gt;why&lt;/strong&gt; it worked, I grasped the concepts much faster
than by reading standard tutorials.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;HTMX:&lt;/strong&gt; I had heard of HTMX at
&lt;a href=&#34;/blog/2026/04/Conflux-Fullstackathon-2026&#34;&gt;The Conflux
fullstackathon 2026&lt;/a&gt; but hadn&amp;#8217;t used it. I wanted a reactive UI for
the Directory Hub without the overhead of a full SPA framework
like React. The AI showed me how to combine Thymeleaf fragments
with HTMX attributes to create a smooth, single-page experience.
By asking questions, I learned exactly how the server-side
rendering and client-side swapping interacted.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Testcontainers and WireMock:&lt;/strong&gt; I was originally looking for
a Google equivalent to AWS&amp;#8217;s local cloud simulators (like
LocalStack) to test my integrations offline. When I realized that
didn&amp;#8217;t really exist for these specific Workspace APIs, the AI and
I worked out a custom solution using WireMock. We set it up so
that I could use &lt;strong&gt;a single set of mock JSON files&lt;/strong&gt; for two
purposes: running my automated integration tests via
Testcontainers, and spinning up a standalone WireMock Docker
container to manually test the application UI locally.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Spring Retry:&lt;/strong&gt; The Google Drive API is notorious for its
strict rate limits. When my audit CLI started failing with
&lt;code&gt;403 User Rate Limit Exceeded&lt;/code&gt; errors, I discussed the problem
with the AI. It introduced me to Spring Retry, helping me
configure an &lt;code&gt;@Retryable&lt;/code&gt; annotation with an exponential backoff
strategy that elegantly solved the issue without cluttering my
business logic.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Modern Java &amp;amp; CLI UX:&lt;/strong&gt; For the Directory Hub, the AI suggested
utilizing Java&amp;#8217;s Virtual Threads (finalized in Java 21)
(&lt;code&gt;Executors.newVirtualThreadPerTaskExecutor()&lt;/code&gt;) to fetch hundreds
of profile pictures concurrently. For the Drive Audit tool, it
helped me implement a clean command-line interface using Spring&amp;#8217;s
&lt;code&gt;CommandLineRunner&lt;/code&gt;, complete with a progress bar and clean
console logging instead of verbose stack traces.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect2&#34;&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Using an AI web client rather than an integrated, autonomous coding
agent completely changed my relationship with the generated code.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Yes, the AI navigated the obscure legacy Google Shared Contacts
XML API, generated complex boilerplate, and helped me set up
testing environments. But because I had to copy the code, read
it, place it in my project, and consciously ask questions when
it made questionable choices, I understood every moving part.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I didn&amp;#8217;t just get two working applications out of this experiment.
I gained a deep, practical understanding of new libraries, modern
Java features, and the nuances of Hexagonal Architecture. I own
the code because I steered the process, and that makes all the
difference.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;For developers — and managing directors — who feel that technology
is moving faster than they can keep up with, I highly recommend
this approach. A low-barrier hobby project paired with a standard
AI account is a fantastic way to bridge the gap. It turns a
daunting learning curve into an engaging, interactive conversation.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;imageblock text-center&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;/blog/uploads/2026/10/learning-by-steering-desk-developer.jpg&#34; alt=&#34;learning by steering desk developer&#34; width=&#34;50%&#34;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
        <category term="Software Development" scheme="https://jdriven.com/blog/category/Software-Development/" />
        <category term="AI" scheme="https://jdriven.com/blog/category/AI/" />
        <category term="Spring Boot" scheme="https://jdriven.com/blog/tag/Spring-Boot/" />
        <category term="Gemini" scheme="https://jdriven.com/blog/tag/Gemini/" />
        <category term="Hexagonal Architecture" scheme="https://jdriven.com/blog/tag/Hexagonal-Architecture/" />
        <category term="HTMX" scheme="https://jdriven.com/blog/tag/HTMX/" />
    </entry>
</feed>
