<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Josip Musa</title>
    <description>The latest articles on DEV Community by Josip Musa (@anaq_42).</description>
    <link>https://dev.to/anaq_42</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3928888%2F2171e7a5-5b3e-4839-bfec-4597390de215.png</url>
      <title>DEV Community: Josip Musa</title>
      <link>https://dev.to/anaq_42</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anaq_42"/>
    <language>en</language>
    <item>
      <title>Idempotency4j - Java/Spring Boot idempotency library</title>
      <dc:creator>Josip Musa</dc:creator>
      <pubDate>Wed, 13 May 2026 09:15:15 +0000</pubDate>
      <link>https://dev.to/anaq_42/idempotency4j-javaspring-boot-idempotency-library-29f8</link>
      <guid>https://dev.to/anaq_42/idempotency4j-javaspring-boot-idempotency-library-29f8</guid>
      <description>&lt;p&gt;The last couple of months, I ended up implementing idempotency in 2 different Spring Boot projects back to back.&lt;/p&gt;

&lt;p&gt;As I was implementing it in the second project, I decided to look up any existing solutions/libraries for Java/Spring Boot, but I honestly couldn't find one that felt clean and flexible enough for what I needed (and what most people probably need).&lt;/p&gt;

&lt;p&gt;So I decided to build my own and open source it.&lt;/p&gt;

&lt;p&gt;I released it about a month ago:&lt;br&gt;&lt;br&gt;
Repository : &lt;a href="https://github.com/josipmusa/idempotency4j" rel="noopener noreferrer"&gt;https://github.com/josipmusa/idempotency4j&lt;/a&gt;&lt;br&gt;&lt;br&gt;
Maven spring boot starter : &lt;a href="https://central.sonatype.com/artifact/io.github.josipmusa/idempotency-spring-boot-starter" rel="noopener noreferrer"&gt;https://central.sonatype.com/artifact/io.github.josipmusa/idempotency-spring-boot-starter&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The goal was to make idempotency implementations feel straightforward and easy, but also to not scope it only to spring boot or a certain storage implementation. The library has a core which can be used on any method with pluggable storage backends. It also has an integration with spring web (servlet-based for now) and a spring boot starter to simplify usage.&lt;/p&gt;

&lt;p&gt;Usage example for a spring boot project:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@PostMapping("/payments")
@Idempotent
public ResponseEntity&amp;lt;Payment&amp;gt; createPayment(@RequestBody PaymentRequest request) {
 // Runs exactly once per unique Idempotency-Key value.
 // Subsequent identical requests get the stored response replayed.
 return ResponseEntity.ok(paymentService.charge(request));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Right now it supports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spring MVC (Servlet-based apps)&lt;/li&gt;
&lt;li&gt;JDBC storage (so it works out of the box with MySQL / PostgreSQL setups most people already have)&lt;/li&gt;
&lt;li&gt;In-memory storage&lt;/li&gt;
&lt;li&gt;duplicate request detection&lt;/li&gt;
&lt;li&gt;replaying previous responses&lt;/li&gt;
&lt;li&gt;concurrent request protection&lt;/li&gt;
&lt;li&gt;request fingerprinting&lt;/li&gt;
&lt;li&gt;configurable TTLs&lt;/li&gt;
&lt;li&gt;pluggable storage backends&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Curious whether others have run into this same problem and whether this library helps solve it for them.&lt;br&gt;&lt;br&gt;
Open to any feedback, suggestions, or reviews.&lt;/p&gt;

</description>
      <category>java</category>
      <category>opensource</category>
      <category>springboot</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
