<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://feeds.feedblitz.com/feedblitz_rss.xslt"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:webfeeds="http://webfeeds.org/rss/1.0"  xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
<channel>
	<title>Baeldung</title>
	<atom:link href="https://www.baeldung.com/feed" rel="self" type="application/rss+xml" />
	<link>https://www.baeldung.com</link>
	<description>Java, Spring and Web Development tutorials</description>
	<lastBuildDate>Sat, 28 Nov 2026 13:06:20 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
<meta xmlns="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
<item>
<feedburner:origLink>https://www.baeldung.com/java-weekly-673</feedburner:origLink>
		<title>Java Weekly, Issue 673</title>
		<link>https://feeds.feedblitz.com/~/974394263/0/baeldung</link>
					<comments>https://feeds.feedblitz.com/~/974394263/0/baeldung#respond</comments>
		
		<dc:creator><![CDATA[baeldung]]></dc:creator>
		<pubDate>Sat, 28 Nov 2026 13:06:20 +0000</pubDate>
				<category><![CDATA[Weekly Review]]></category>
		<category><![CDATA[no-ads]]></category>
		<category><![CDATA[no-after-post]]></category>
		<category><![CDATA[no-before-post]]></category>
		<category><![CDATA[no-optins]]></category>
		<guid isPermaLink="false">https://www.baeldung.com/?p=205580</guid>
					<description><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="max-width:100% !important;height:auto !important;float: left; margin-right: 5px;" fetchpriority="high" /><p>Lots and lots of solid releases this week. And the last week of our Black Friday launch.</p>
<p>The post <a rel="NOFOLLOW" href="https://feeds.feedblitz.com/~/974394263/0/baeldung">Java Weekly, Issue 673</a> first appeared on <a rel="NOFOLLOW" href="https://www.baeldung.com">Baeldung</a>.</p><div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/974394263/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/974394263/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2016%2f10%2fsocial-Weekly-Reviews-4.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/974394263/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/974394263/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/974394263/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/java-weekly-673#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/java-weekly-673/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</description>
										<content:encoded><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="float: left; margin-right: 5px;" decoding="async" srcset="https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4.jpg 952w, https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4-300x157.jpg 300w, https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4-768x402.jpg 768w" sizes="(max-width: 580px) 100vw, 580px" /><h2 style="text-align: left;" id="bd-spring-and-java" data-id="spring-and-java">1.<strong> Spring and Java</strong></h2>
<div class="bd-anchor" id="spring-and-java"></div>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://inside.java/2026/11/23/evolving-java-language/">&gt;&gt; Evolving the Java Language: An Inside Perspective</a></strong> [<span style="color: #993300;">inside.java</span>]</p>
<p>Why do some &#8220;obvious&#8221; improvements never make it into Java, while lambdas, records, pattern matching and virtual threads feel like they&#8217;ve always been there? In the JavaOne keynote, Brian Goetz takes goes over the inside thinking. Of course it&#8217;s more complicated than it would seem.</p>
<h4><strong>Also worth reading:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/24/spring-ai-tool-call-confirmation-park-resume" target="_blank" rel="noopener"><strong>Human in the Loop with Spring AI 2.1: Tool Calls That Survive a Restart</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/java4shell-are-we-exposed/" target="_blank" rel="noopener"><strong>Java4Shell: Are We Exposed? And What It Tells Us About What&#8217;s Coming</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.wildfly.org/news/2026/11/20/WildFly-and-Java4Shell/" target="_blank" rel="noopener"><strong>WildFly and Java4Shell</strong></a> [<span style="color: #800000;">wildfly.org</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.jetbrains.com/security/2026/11/java4shell-vulnerability/" target="_blank" rel="noopener"><strong>Java4Shell Vulnerability: Update Your JetBrains IDEs, ReSharper, .NET Tools, Toolbox App, and Gateway Now</strong></a> [<span style="color: #800000;">jetbrains.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blogs.oracle.com/java/transitioning-java-to-more-frequent-security-updates" target="_blank" rel="noopener"><strong>Transitioning Java to more frequent security updates</strong></a> [<span style="color: #800000;">oracle.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/what-makes-java-containers-secure/" target="_blank" rel="noopener"><strong>Small, Signed, and Still Vulnerable? What Really Makes a Java Container Secure</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.infoq.com/news/2026/11/jep-545-jdk-28/" target="_blank" rel="noopener"><strong>JEP 545 Moves ZGC Memory Preparation off the Startup Path in JDK 28</strong></a> [<span style="color: #800000;">infoq.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://inside.java/2026/11/20/jep547-target-jdk28/" target="_blank" rel="noopener"><strong>JEP targeted to JDK 28: 547: Lazy Constants (4th Preview)</strong></a> [<span style="color: #800000;">inside.java</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://inside.java/2026/11/25/quality-heads-up/" target="_blank" rel="noopener"><strong>JDK 28: New jlink Security Properties Plugin &#8211; Quality Outreach Heads-up</strong></a> [<span style="color: #800000;">inside.java</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://webtechie.be/post/do-you-know-which-java-build-you-are-running/" target="_blank" rel="noopener"><strong>Do You Know Which Java Build You Are Running?</strong></a> [<span style="color: #800000;">webtechie.be</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/which-jdk-are-you-on-and-what-stops-you-upgrading/" target="_blank" rel="noopener"><strong>Which JDK are you on &amp; what stops you upgrading?</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blogs.oracle.com/java/post-quantum-cryptography-on-java-card-apis-designed-for-secure-elements" target="_blank" rel="noopener"><strong>Post-Quantum Cryptography on Java Card: APIs Designed for Secure Elements</strong></a> [<span style="color: #800000;">oracle.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/idempotent-spring-boot-1-1/" target="_blank" rel="noopener"><strong>Idempotent Spring Boot: From 0.1 to 1.1 — Lessons in Reliability, Performance, and Open Source</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/one-yaml-model-for-spring-boot-architecture-ai-coding-bi/" target="_blank" rel="noopener"><strong>Put the structure of your Spring Boot service in a YAML model: architecture changes, AI coding and BI from one source</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.wimdeblauwe.com/blog/2026/11/23/building-an-application-with-shadleaf---part-2/" target="_blank" rel="noopener"><strong>Building an application with Shadleaf &#8211; part 2</strong></a> [<span style="color: #800000;">wimdeblauwe.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.wimdeblauwe.com/blog/2026/11/23/modern-frontends-with-htmx-2nd-edition-release/" target="_blank" rel="noopener"><strong>Modern frontends with htmx 2nd edition release</strong></a> [<span style="color: #800000;">wimdeblauwe.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/reactive-messaging-on-quarkus/" target="_blank" rel="noopener"><strong>Reactive Messaging on Quarkus</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/evaluating-java-ai-agents-with-harness-evals/" target="_blank" rel="noopener"><strong>Evaluating Java AI Agents with Harness Evals</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/agent-tool-calls-run-twice/" target="_blank" rel="noopener"><strong>Your Agent&#8217;s Tool Calls Will Run Twice: Idempotency and Evaluation Gates in Java Services</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/build-full-stack-web-app-in-java-with-webforj/" target="_blank" rel="noopener"><strong>Building a full-stack web app using only Java, in 5 small classes</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
</ul>
<h4><strong>Webinars and presentations:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/19/a-bootiful-podcast-november-19th-2026" target="_blank" rel="noopener"><strong>A Bootiful Podcast: JobRunr founder Ronald Dehuysser</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
</ul>
<h4><strong>Time to upgrade:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/19/spring-boot-4-2-0-available-now" target="_blank" rel="noopener"><strong>Spring Boot 4.2.0 available now</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/20/spring-boot-4-1-3-available-now" target="_blank" rel="noopener"><strong>Spring Boot 4.1.3 available now</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/20/spring-boot-4-0-10-available-now" target="_blank" rel="noopener"><strong>Spring Boot 4.0.10 available now</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/20/spring-ai-2-1-0-GA-available-now" target="_blank" rel="noopener"><strong>Spring AI 2.1.0 GA and 2.0.3 GA Available Now</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/19/spring-data-2026-1-0-generally-available" target="_blank" rel="noopener"><strong>Spring Data 2026.1.0 generally available</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/19/spring-data-2026-0-3-and-2025-1-9-released" target="_blank" rel="noopener"><strong>Spring Data 2026.0.3 and 2025.1.9 released</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/20/spring-cloud-2026-0-0-has-been-released" target="_blank" rel="noopener"><strong>Spring Cloud 2026.0.0 (aka Paddington) Has Been Released</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/20/spring-cloud-2025-1-5-has-been-released" target="_blank" rel="noopener"><strong>Spring Cloud 2025.1.5 (aka Oakwood) Has Been Released</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/19/spring-batch-6-1-0-available-now" target="_blank" rel="noopener"><strong>Spring Batch 6.1 is now GA!</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/19/spring-modulith-2-2-ga-2-1-3-and-2-0-10-released" target="_blank" rel="noopener"><strong>Spring Modulith 2.2 GA, 2.1.3, and 2.0.10 released</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/19/spring-kafka-4" target="_blank" rel="noopener"><strong>Spring for Apache Kafka 4.2.0, 4.1.3, and 4.0.9 Available</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/19/spring-integration-7-2-0-available" target="_blank" rel="noopener"><strong>Spring Integration 7.2.0 Available</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/19/spring-amqp-4-2-0-available" target="_blank" rel="noopener"><strong>Spring AMQP 4.2.0 Available</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/19/spring-shell-4-0-4-available-now" target="_blank" rel="noopener"><strong>Spring Shell 4.0.4 available now</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/19/spring-vault-4-0-5-4-1-2-available" target="_blank" rel="noopener"><strong>Spring Vault 4.0.5 and 4.1.2 available</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/19/spring-ws-5-1-0-available-now" target="_blank" rel="noopener"><strong>Spring Web Services 5.1.0 available now</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/19/spring-ws-5-0-4-available-now" target="_blank" rel="noopener"><strong>Spring Web Services 5.0.4 available now</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://quarkus.io/blog/quarkus-4-0-released/" target="_blank" rel="noopener"><strong>Quarkus 4.0, our new major release, is here!</strong></a> [<span style="color: #800000;">quarkus.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://in.relation.to/2026/11/20/hibernate-validator-9-2-0-Final/" target="_blank" rel="noopener"><strong>Hibernate Validator 9.2.0.Final is out</strong></a> [<span style="color: #800000;">relation.to</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://in.relation.to/2026/11/25/hibernate-reactive-5_1_0_CR3/" target="_blank" rel="noopener"><strong>Hibernate Reactive 5.1.0.CR3 and 5.0.0.Final released</strong></a> [<span style="color: #800000;">relation.to</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blogs.oracle.com/java/java-card-development-kit-26-1-post-quantum-cryptography-and-a-more-interactive-development-workflow" target="_blank" rel="noopener"><strong>Java Card Development Kit 26.1: Post-Quantum Cryptography and a More Interactive Development Workflow</strong></a> [<span style="color: #800000;">oracle.com</span>]</li>
<li><strong>&gt;&gt;</strong> Quarkus <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/quarkusio/quarkus/releases/tag/4.0.1" target="_blank" rel="noopener"><strong>4.0.1</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/quarkusio/quarkus/releases/tag/3.40.2" target="_blank" rel="noopener"><strong>3.40.2</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/quarkusio/quarkus/releases/tag/3.33.5" target="_blank" rel="noopener"><strong>3.33.5</strong></a> [<span style="color: #800000;">github.com/quarkusio</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/graalvm/graalvm-ce-builds/releases/tag/graal-25.6.5.1" target="_blank" rel="noopener"><strong>GraalVM Community 25 Innovation 6</strong></a> [<span style="color: #800000;">github.com/graalvm</span>]</li>
<li><strong>&gt;&gt;</strong> Micronaut Core <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/micronaut-projects/micronaut-core/releases/tag/v5.2.26" target="_blank" rel="noopener"><strong>5.2.26</strong></a> [<span style="color: #800000;">github.com/micronaut-projects</span>]</li>
<li><strong>&gt;&gt;</strong> Maven <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/apache/maven/releases/tag/maven-3.10.2" target="_blank" rel="noopener"><strong>3.10.2</strong></a> [<span style="color: #800000;">github.com/apache</span>]</li>
<li><strong>&gt;&gt;</strong> Elasticsearch <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/elastic/elasticsearch/releases/tag/v9.5.7" target="_blank" rel="noopener"><strong>9.5.7</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/elastic/elasticsearch/releases/tag/v9.4.10" target="_blank" rel="noopener"><strong>9.4.10</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/elastic/elasticsearch/releases/tag/v8.19.26" target="_blank" rel="noopener"><strong>8.19.26</strong></a> [<span style="color: #800000;">github.com/elastic</span>]</li>
<li><strong>&gt;&gt;</strong> Micrometer <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/micrometer-metrics/micrometer/releases/tag/v1.18.0" target="_blank" rel="noopener"><strong>1.18.0</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/micrometer-metrics/micrometer/releases/tag/v1.17.3" target="_blank" rel="noopener"><strong>1.17.3</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/micrometer-metrics/micrometer/releases/tag/v1.16.9" target="_blank" rel="noopener"><strong>1.16.9</strong></a> [<span style="color: #800000;">github.com/micrometer-metrics</span>]</li>
<li><strong>&gt;&gt;</strong> Camel <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/apache/camel/releases/tag/camel-4.22.3" target="_blank" rel="noopener"><strong>4.22.3</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/apache/camel/releases/tag/camel-4.18.6" target="_blank" rel="noopener"><strong>4.18.6</strong></a> [<span style="color: #800000;">github.com/apache</span>]</li>
</ul>
<h2 style="text-align: left;" id="bd-technical-amp-musings" data-id="technical-amp-musings">2.<strong> Technical &amp; Musings</strong></h2>
<div class="bd-anchor" id="technical-amp-musings"></div>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.frankel.ch/reviewing-ai-generated-code/">&gt;&gt; On reviewing AI-generated code</a></strong> [<span style="color: #993300;">frankel.ch</span>]</p>
<p>Agents can produce code far faster than anyone can read it, and review effectiveness drops sharply as we review more. Nicolas argues control isn&#8217;t lost but partitioned. An interesting weekend read.</p>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.allthingsdistributed.com/2026/11/tech-predictions-for-2027-and-beyond.html">&gt;&gt; Tech predictions for 2027 and beyond</a></strong> [<span style="color: #993300;">allthingsdistributed.com</span>]</p>
<p>Werner Vogels&#8217; yearly predictions are always worth the read. Security is naturally a core focus.</p>
<h4><strong>Also worth reading:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/one-does-not-simply-vibe-code-my-executor/" target="_blank" rel="noopener"><strong>One Does Not Simply Vibe-Code My Executor</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.christianposta.com/credential-brokering-patterns-for-ai-agent-egress-part4/" target="_blank" rel="noopener"><strong>Credential Brokering Patterns for AI Agents Part 4: Eliminating Plaintext</strong></a> [<span style="color: #800000;">christianposta.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.scottlogic.com/2026/11/24/jev-is-all-you-need-the-advent-of-decision-models.html" target="_blank" rel="noopener"><strong>Jev Is All You Need? The Advent of Decision Models</strong></a> [<span style="color: #800000;">scottlogic.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.jetbrains.com/kotlin/2026/11/kotlin-benchmark-2-0-how-ai-coding-agents-handle-harder-tasks-and-closed-source-code/" target="_blank" rel="noopener"><strong>Kotlin Benchmark 2.0: How AI Coding Agents Handle Harder Tasks and Closed-Source Code</strong></a> [<span style="color: #800000;">jetbrains.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.codecentric.de/en/knowledge-hub/blog/five-level-llm-stack" target="_blank" rel="noopener"><strong>Five Layers of the LLM Stack: What’s Behind Cursor</strong></a> [<span style="color: #800000;">codecentric.de</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.codecentric.de/en/knowledge-hub/blog/graph-based-software-analysis-for-source-code-archaeology" target="_blank" rel="noopener"><strong>Graph-Based Software Analysis for Source Code Archaeology</strong></a> [<span style="color: #800000;">codecentric.de</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.eisele.net/2026/11/what-fm-serve-help-leaves-out-about.html" target="_blank" rel="noopener"><strong>What fm serve &#8211;help leaves out about Apple’s on-device model</strong></a> [<span style="color: #800000;">eisele.net</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.codenameone.com/blog/shopify-was-wrong-and-right-to-dump-react-native/" target="_blank" rel="noopener"><strong>Shopify Was Wrong and Right to Dump React Native</strong></a> [<span style="color: #800000;">codenameone.com</span>]</li>
</ul>
<h2 style="text-align: left;" id="bd-pick-of-the-week" data-id="pick-of-the-week">3.<strong> Pick of the Week</strong></h2>
<div class="bd-anchor" id="pick-of-the-week"></div>
<p>And we have a new platform homepage along with the last week of the Black Friday launch:</p>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://platform.baeldung.com/">&gt;&gt; The Baeldung New Paltform</a></strong></p><p>The post <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-weekly-673">Java Weekly, Issue 673</a> first appeared on <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com">Baeldung</a>.</p><Img align="left" border="0" height="1" width="1" alt="" style="border:0;float:left;margin:0;padding:0;width:1px!important;height:1px!important;" hspace="0" src="https://feeds.feedblitz.com/~/i/974394263/0/baeldung">
<div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/974394263/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/974394263/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2016%2f10%2fsocial-Weekly-Reviews-4.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/974394263/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/974394263/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/974394263/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/java-weekly-673#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/java-weekly-673/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</content:encoded>
					
					<wfw:commentRss>https://feeds.feedblitz.com/~/974394263/0/baeldung/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<webfeeds:featuredImage>https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4-150x150.jpg</webfeeds:featuredImage></item>
<item>
<feedburner:origLink>https://www.baeldung.com/java-palantir-formatter</feedburner:origLink>
		<title>Guide to Palantir Code Formatter</title>
		<link>https://feeds.feedblitz.com/~/974043803/0/baeldung</link>
					<comments>https://feeds.feedblitz.com/~/974043803/0/baeldung#respond</comments>
		
		<dc:creator><![CDATA[Daniel Fintinariu]]></dc:creator>
		<pubDate>Thu, 26 Nov 2026 05:29:02 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[IntelliJ]]></category>
		<guid isPermaLink="false">https://www.baeldung.com/?p=205528</guid>
					<description><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="max-width:100% !important;height:auto !important;float: left; margin-right: 5px;" /><p>Explore how lambda-friendly palantir-java-format differs from google-java-format, how to integrate it into Gradle and Maven builds, and how to wire it into IntelliJ IDEA.</p>
<p>The post <a rel="NOFOLLOW" href="https://feeds.feedblitz.com/~/974043803/0/baeldung">Guide to Palantir Code Formatter</a> first appeared on <a rel="NOFOLLOW" href="https://www.baeldung.com">Baeldung</a>.</p><div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/974043803/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/974043803/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f07%2fJava-Featured-11-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/974043803/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/974043803/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/974043803/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/java-palantir-formatter#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/java-palantir-formatter/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</description>
										<content:encoded><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="float: left; margin-right: 5px;" decoding="async" loading="lazy" srcset="https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-1024x536.jpg 1024w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-300x157.jpg 300w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-768x402.jpg 768w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-100x52.jpg 100w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11.jpg 1200w" sizes="auto, (max-width: 580px) 100vw, 580px" /><h2 id="bd-overview" data-id="overview">1. Overview</h2>
<div class="bd-anchor" id="overview"></div>
<p>Code <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/cs/clean-code-formatting">formatting</a> debates can consume a surprising amount of engineering time during reviews and even before starting a project. An automatic formatter applying a standardized set of rules across the codebase reduces nitpicking in code reviews, keeps repositories consistent, and helps new developers get up to speed.</p>
<p>In this tutorial, we&#8217;ll explore <em>palantir-java-format.</em> It&#8217;s a modern and lambda-friendly Java formatter with a 120-character line limit. We&#8217;ll look at how it differs from <em>google-java-format</em>, show how to integrate it into Gradle and Maven builds, and finally, we&#8217;ll wire it into IntelliJ IDEA.</p>
<h2 id="bd-what-is-palantir-java-format" data-id="what-is-palantir-java-format">2. What Is <em>palantir-java-format</em>?</h2>
<div class="bd-anchor" id="what-is-palantir-java-format"></div>
<p><strong>Palantir Technologies maintains <em>palantir-java-format</em>, an opinionated Java formatter</strong>. It&#8217;s a fork of <em>google-java-format</em> and ships under the Apache 2.0 license. However, its default style differs from its ancestor in three ways:</p>
<ul>
<li>It raises the line limit from 100 to 120 characters, so less code needs wrapping.</li>
<li>Indents use four spaces instead of Google style&#8217;s two.</li>
<li>Perhaps most importantly, it keeps lambdas and method chains compact. Whereas <em>google-java-format</em> indents each nested lambda further to the right, <em>palantir-java-format</em> places lambdas inline, so the code takes fewer lines and stays closer to the left margin.</li>
</ul>
<h2 id="bd-example-formatting-style-in-practice" data-id="example-formatting-style-in-practice">3. Example: Formatting Style in Practice</h2>
<div class="bd-anchor" id="example-formatting-style-in-practice"></div>
<p>Let&#8217;s start with <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/palantir/palantir-java-format#motivation--examples">the project&#8217;s own example</a>. Here&#8217;s how <em>google-java-format</em> lays out a Gradle configuration method with nested lambdas:</p>
<pre><code class="language-java">private static void configureResolvedVersionsWithVersionMapping(Project project) {
    project.getPluginManager()
            .withPlugin(
                    "maven-publish",
                    plugin -&gt; {
                        project.getExtensions()
                                .getByType(PublishingExtension.class)
                                .getPublications()
                                .withType(MavenPublication.class)
                                .configureEach(
                                        publication -&gt;
                                                publication.versionMapping(
                                                        mapping -&gt; {
                                                            mapping.allVariants(
                                                                    VariantVersionMappingStrategy
                                                                            ::fromResolutionResult);
                                                        }));
                    });
}</code></pre>
<p>In contrast, <strong><em>palantir-java-format</em> places the lambdas inline and removes most of the indentation</strong>:</p>
<pre><code class="language-java">private static void configureResolvedVersionsWithVersionMapping(Project project) {
    project.getPluginManager().withPlugin("maven-publish", plugin -&gt; {
        project.getExtensions()
                .getByType(PublishingExtension.class)
                .getPublications()
                .withType(MavenPublication.class)
                .configureEach(publication -&gt; publication.versionMapping(mapping -&gt; {
                    mapping.allVariants(VariantVersionMappingStrategy::fromResolutionResult);
                }));
    });
}</code></pre>
<p>The Palantir version needs 11 lines instead of 19, and its deepest indentation drops from 76 spaces to 20.</p>
<h2 id="bd-setup" data-id="setup">4. Setup</h2>
<div class="bd-anchor" id="setup"></div>
<p><em>palantir-java-format</em> doesn’t ship a task that formats a whole project. Instead, we run it through <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-maven-spotless-plugin">Spotless</a> in the build and through a plugin in the IDE.</p>
<h3 id="bd-1-spotless-plugin" data-id="1-spotless-plugin">4.1. Spotless Plugin</h3>
<div class="bd-anchor" id="1-spotless-plugin"></div>
<p><strong>Spotless is a general-purpose formatting plugin for Gradle, Maven, and sbt</strong>. Rather than formatting code itself, it runs a chain of formatter steps, and <em>palantir-java-format</em> plugs in as one of them.</p>
<p>Spotless offers two operations: the check operation, which fails the build when a file differs from the formatter&#8217;s output, and the apply operation, which rewrites the file to match. Typically, CI runs the check, and developers run apply before committing. Note that <strong>Spotless needs Java 17 or newer.</strong></p>
<h3 id="bd-2-gradle" data-id="2-gradle">4.2. Gradle</h3>
<div class="bd-anchor" id="2-gradle"></div>
<p>In a <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/gradle">Gradle</a> project, we apply Palantir’s plugin alongside Spotless:</p>
<pre><code class="language-groovy">plugins {
    id 'java'
    id 'com.diffplug.spotless' version '8.10.4'
    id 'com.palantir.java-format' version '2.102.0'
}</code></pre>
<p>That’s the whole configuration. The Palantir plugin adds its formatter to Spotless as a step and skips generated sources, so we don’t add a <em>palantirJavaFormat()</em> step ourselves. Then, <em>./gradlew spotlessApply</em> formats the code, and <em>./gradlew spotlessCheck</em> reports violations. Since Spotless also hooks its check into Gradle’s <em>check</em> task, <em>./gradlew build</em> fails on unformatted code too.</p>
<p>Additionally, the plugin adds a <em>formatDiff</em> task, which formats only uncommitted changes.</p>
<h3 id="bd-3-maven" data-id="3-maven">4.3. Maven</h3>
<div class="bd-anchor" id="3-maven"></div>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/maven-series">Maven</a> has no Palantir plugin, so we configure Spotless directly</strong>:</p>
<pre><code class="language-xml">&lt;plugin&gt;
    &lt;groupId&gt;com.diffplug.spotless&lt;/groupId&gt;
    &lt;artifactId&gt;spotless-maven-plugin&lt;/artifactId&gt;
    &lt;version&gt;3.10.4&lt;/version&gt;
    &lt;configuration&gt;
        &lt;java&gt;
            &lt;palantirJavaFormat&gt;
                &lt;version&gt;2.102.0&lt;/version&gt;
            &lt;/palantirJavaFormat&gt;
        &lt;/java&gt;
    &lt;/configuration&gt;
    &lt;executions&gt;
        &lt;execution&gt;
            &lt;goals&gt;
                &lt;goal&gt;check&lt;/goal&gt;
            &lt;/goals&gt;
        &lt;/execution&gt;
    &lt;/executions&gt;
&lt;/plugin&gt;</code></pre>
<p>Here, the <em>palantirJavaFormat</em> element adds the formatter step, and pinning its version keeps every machine on the same output. Because Spotless binds the <em>check</em> goal to the <em>verify</em> phase, <em>mvn verify</em> now fails on unformatted code, while <em>mvn spotless:apply</em> fixes it.</p>
<h3 id="bd-4-intellij" data-id="4-intellij">4.4. IntelliJ</h3>
<div class="bd-anchor" id="4-intellij"></div>
<p><strong>Next, we install the <em>palantir-java-format</em> plugin from the JetBrains Marketplace</strong>.</p>
<p>In a Gradle project, IntelliJ recommends the plugin and configures it on import, thanks to Palantir&#8217;s Gradle plugin. On Maven, we enable it under <em>File &#8211; Plugins</em>:</p>
<a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/wp-content/uploads/2026/11/palantir_enable_formatter.jpg"><img loading="lazy" decoding="async" class="alignnone wp-image-205529 size-large" src="https://www.baeldung.com/wp-content/uploads/2026/11/palantir_enable_formatter-1024x836.jpg" alt="Palantir code formatter enabled" width="580" height="474" srcset="https://www.baeldung.com/wp-content/uploads/2026/11/palantir_enable_formatter-1024x836.jpg 1024w, https://www.baeldung.com/wp-content/uploads/2026/11/palantir_enable_formatter-300x245.jpg 300w, https://www.baeldung.com/wp-content/uploads/2026/11/palantir_enable_formatter-768x627.jpg 768w, https://www.baeldung.com/wp-content/uploads/2026/11/palantir_enable_formatter-100x82.jpg 100w, https://www.baeldung.com/wp-content/uploads/2026/11/palantir_enable_formatter-600x490.jpg 600w, https://www.baeldung.com/wp-content/uploads/2026/11/palantir_enable_formatter.jpg 1119w" sizes="auto, (max-width: 580px) 100vw, 580px" /></a>
<p>Either way, <em>Reformat Code (Ctrl+Alt+L)</em> now matches the build&#8217;s output.</p>
<h3 id="bd-5-java-21" data-id="5-java-21">4.5. Java 21</h3>
<div class="bd-anchor" id="5-java-21"></div>
<p><strong>Finally, formatting Java 21 code requires Java 21 wherever the formatter runs</strong>: the Gradle daemon and IntelliJ project SDK, or the JDK that runs Maven.</p>
<p>Alternatively, Gradle users can set <em>palantir.native.formatter=true</em> in <em>gradle.properties</em> for a native image that starts over ten times faster. However, it&#8217;s slower on large batches, so <em>spotlessApply</em> sticks with the Java implementation on Java 21 or newer.</p>
<h2 id="bd-how-the-formatter-works" data-id="how-the-formatter-works">5. How the Formatter Works</h2>
<div class="bd-anchor" id="how-the-formatter-works"></div>
<p><em>palantir-java-format</em> ignores our existing layout and rebuilds every line from scratch:</p>
<ol>
<li>First, it parses the file with <em>javac</em>&#8216;s own parser and keeps track of every comment.</li>
<li>Next, it turns the syntax tree into nested levels, which are groups of code with optional line breaks inside them.</li>
<li>Finally, it fits those levels into 120 columns, keeping a level on one line when it fits and breaking it when it doesn&#8217;t.</li>
</ol>
<p><strong>Before breaking a whole level, Palantir tries to break only its last part, such as a trailing lambda, as long as everything before it stays on one line.</strong> That’s what produces the compact lambdas we saw in chapter 3.</p>
<p>As a result, the formatter behaves predictably. It changes only the layout, apart from reordering modifiers to match the Java Language Specification and, through Spotless, sorting imports and removing unused ones. It also collapses consecutive blank lines; a second run changes nothing, and code that doesn&#8217;t parse throws a <em>FormatterException</em>.</p>
<h2 id="bd-formatting-code" data-id="formatting-code">6. Formatting Code</h2>
<div class="bd-anchor" id="formatting-code"></div>
<p>Now, let’s see these rules in action. For each case, we’ll state the rule, look at code that breaks it, and check the formatted result.</p>
<h3 id="bd-1-indentation-and-spacing" data-id="1-indentation-and-spacing">6.1. Indentation and Spacing</h3>
<div class="bd-anchor" id="1-indentation-and-spacing"></div>
<p>The formatter indents each level with four spaces, puts single spaces around operators and arrows, and gives each statement in a block its own line.</p>
<p>Let’s take a look at a method that decides how many lives a player gets:</p>
<pre><code class="language-java">int startingLives(int level) {
  return switch (level) {
    case 1  -&gt; 5;
    case 2  -&gt; 3;
    default -&gt; { int bonus = level/10; return 1 + bonus; }
  };
}</code></pre>
<p>This snippet breaks all three rules. It indents with two spaces, pads the arrows, squeezes <em>level/10</em> together, and puts two statements onto one line. After formatting, each level sits four spaces deeper, the spacing is uniform, and each statement has its own line:</p>
<pre><code class="language-java">int startingLives(int level) {
    return switch (level) {
        case 1 -&gt; 5;
        case 2 -&gt; 3;
        default -&gt; {
            int bonus = level / 10;
            return 1 + bonus;
        }
    };
}</code></pre>
<h3 id="bd-2-short-method-chains" data-id="2-short-method-chains">6.2. Short Method Chains</h3>
<div class="bd-anchor" id="2-short-method-chains"></div>
<p>When a method chain fits on one line and its last dot starts before column 80, the formatter puts the whole chain on one line. Here, we split a short chain by hand:</p>
<pre><code class="language-java">Quest recruit() {
    return party
        .join(npc -&gt; isFriendly())
        .startQuest();
}</code></pre>
<p>The statement fits, yet it spreads across three lines, which breaks the rule. So, the formatter joins it back into a single 56-character line, with its last dot at column 43:</p>
<pre><code class="language-java">Quest recruit() {
    return party.join(npc -&gt; isFriendly()).startQuest();
}</code></pre>
<h3 id="bd-3-long-method-chains" data-id="3-long-method-chains">6.3. Long Method Chains</h3>
<div class="bd-anchor" id="3-long-method-chains"></div>
<p>However, <strong>if the last dot would start after column 80, the formatter puts each call on its own line</strong>, even when the statement fits within 120 characters. Let’s look at this chain:</p>
<pre><code class="language-java">void buildDesertLevel() {
    new LevelBuilder().withBackground(new DesertSand()).spawnMobs(wave, Skeletons.class).buildRoom();
}</code></pre>
<p>At 101 characters, the line fits, but its last dot starts at column 89, which breaks the rule. As a result, the formatter splits the chain into one call per line, and every dot now starts at column 13:</p>
<pre><code class="language-java">void buildDesertLevel() {
    new LevelBuilder()
            .withBackground(new DesertSand())
            .spawnMobs(wave, Skeletons.class)
            .buildRoom();
}</code></pre>
<p>This way, extra calls like <em>buildRoom()</em> can’t hide at the end of a long line.</p>
<h3 id="bd-4-block-lambdas" data-id="4-block-lambdas">6.4. Block Lambdas</h3>
<div class="bd-anchor" id="4-block-lambdas"></div>
<p>When a block <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-8-lambda-expressions-tips">lambda</a> is the last argument, the formatter keeps the opening brace next to the call and indents the body one step deeper than the statement. Consider this over-indented game loop:</p>
<pre><code class="language-java">World update() {
    return world.step(now -&gt; {
                moveHeroes();
                checkCollision();
            });
}</code></pre>
<p>Here, the body sits twelve spaces deeper than return, and the closing <em>});</em> doesn’t line up with the statement, which breaks the rule. After formatting, the brace still follows the call, the body sits four spaces past return, and <em>});</em> lines up with the statement:</p>
<pre><code class="language-java">World update() {
    return world.step(now -&gt; {
        moveHeroes();
        checkCollision();
    });
}</code></pre>
<h3 id="bd-5-expression-lambdas" data-id="5-expression-lambdas">6.5. Expression Lambdas</h3>
<div class="bd-anchor" id="5-expression-lambdas"></div>
<p>Expression lambdas, on the other hand, behave differently. Rather than leave <em>() -&gt;</em> dangling at the end of a line, the formatter puts each argument on its own line and keeps the lambda in one piece. Let&#8217;s check out this snippet:</p>
<pre><code class="language-java">class WaveSpawner {
    Wave nextWave() {
        return spawnEnemyWave(player, config, heroStats, gameEventsSink, monsterClass, HARD_MODE, formation, () -&gt;
                new RevivalTimerConfig(config.maxNumRevives(), config.reviveDelayInMs()));
    }
}</code></pre>
<p>Because the call is too long for one line, this snippet ends the first line with <em>() -&gt;</em> and pushes the lambda’s body to the next one, which breaks the rule. After formatting, every argument has its own line, and the lambda stays in one piece on the last one:</p>
<pre><code class="language-java">class WaveSpawner {
    Wave nextWave() {
        return spawnEnemyWave(
                player,
                config,
                heroStats,
                gameEventsSink,
                monsterClass,
                HARD_MODE,
                formation,
                () -&gt; new RevivalTimerConfig(config.maxNumRevives(), config.reviveDelayInMs()));
    }
}</code></pre>
<h3 id="bd-6-annotated-records" data-id="6-annotated-records">6.6. Annotated Records</h3>
<div class="bd-anchor" id="6-annotated-records"></div>
<p>Finally, records that map JSON game data often carry long <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-default-annotations">annotations</a>. If a component’s type would start past column 60, the formatter moves its annotations onto their own line and separates the component from its neighbors with blank lines. Let’s take this record as an example:</p>
<pre><code class="language-java">public record Item(
    @JsonProperty("inventory_weight") @JsonPropertyDescription("How heavy the item is in the bag.")
        Double inventoryWeight,
    @JsonProperty("stackable") @JsonPropertyDescription("Items that share a single slot.") Boolean canStack,
    @JsonProperty("hp") @JsonPropertyDescription("Health restored.") Integer hp) {}</code></pre>
<p>Here, Boolean starts at column 92 and Integer at column 70, both past the limit, even though both lines fit within 120 characters. Also, no blank lines separate the components.</p>
<pre><code class="language-java">public record Item(
        @JsonProperty("inventory_weight") @JsonPropertyDescription("How heavy the item is in the bag.")
        Double inventoryWeight,
        @JsonProperty("stackable") @JsonPropertyDescription("Items that share a single slot.")
        Boolean canStack,
        @JsonProperty("hp") @JsonPropertyDescription("Health restored.")
        Integer hp) {}</code></pre>
<h2 id="bd-cheat-sheet" data-id="cheat-sheet">7. Cheat Sheet</h2>
<div class="bd-anchor" id="cheat-sheet"></div>
<p>Let’s put the main rules side by side. The following table contrasts <em>palantir-java-format</em> with <em>google-java-format</em>’s default style:</p>
<table class="table-styled" style="width: 100%;height: 288px">
<thead>
<tr style="height: 24px">
<th style="height: 24px">Feature</th>
<th style="height: 24px">palantir-java-format</th>
<th style="height: 24px">google-java-format</th>
</tr>
</thead>
<tbody>
<tr style="height: 24px">
<td style="height: 24px">Max line length</td>
<td style="height: 24px">120 characters</td>
<td style="height: 24px">100 characters</td>
</tr>
<tr style="height: 24px">
<td style="height: 24px">Block indentation</td>
<td style="height: 24px">4 spaces</td>
<td style="height: 24px">2 spaces</td>
</tr>
<tr style="height: 24px">
<td style="height: 24px">Continuation indentation</td>
<td style="height: 24px">8 spaces</td>
<td style="height: 24px">4 spaces</td>
</tr>
<tr style="height: 24px">
<td style="height: 24px">Method chains</td>
<td style="height: 24px">One call per line if the last dot starts past column 80, even when the chain fits</td>
<td style="height: 24px">Breaks a chain only when it exceeds the line limit</td>
</tr>
<tr style="height: 24px">
<td style="height: 24px">Nested lambdas</td>
<td style="height: 24px">Compact: lambdas stay inline with shallow indentation</td>
<td style="height: 24px">Expanded: each level moves further to the right</td>
</tr>
<tr style="height: 24px">
<td style="height: 24px">Trailing block lambda</td>
<td style="height: 24px">Keeps <em>x -&gt; {</em> on the same line as the call</td>
<td style="height: 24px">Moves the lambda onto its own line</td>
</tr>
<tr style="height: 48px">
<td style="height: 48px">Long expression lambda body</td>
<td style="height: 48px">Keeps the body on the same line as <em>-&gt;</em></td>
<td style="height: 48px">Can break after <em>-&gt;</em> and move the body to the next line</td>
</tr>
<tr style="height: 48px">
<td style="height: 48px">Annotated record components</td>
<td style="height: 48px">Annotations on their own line if the type would start past column 60, plus blank lines between components</td>
<td style="height: 48px">Annotations on their own line only when the line is too long, with no blank lines</td>
</tr>
<tr style="height: 24px">
<td style="height: 24px">Imports and modifiers</td>
<td style="height: 24px">Sorted imports, modifiers in JLS order</td>
<td style="height: 24px">Same</td>
</tr>
</tbody>
</table>
<p>As we can see, both formatters share the same foundation, such as sorted imports and the standard modifier order. However, <em>palantir-java-format</em> allows longer lines, keeps lambdas compact, and adds its own rules for method chains and annotated records.</p>
<h2 id="bd-conclusion" data-id="conclusion">8. Conclusion</h2>
<div class="bd-anchor" id="conclusion"></div>
<p>In this article, we explored <em>palantir-java-format</em>, a <em>google-java-format</em> fork built for modern, lambda-heavy Java.</p>
<p><strong>Before breaking a whole line of code, it tries to break only the last part, so trailing lambdas stay next to their calls</strong> instead of moving into deeply indented blocks. As a result, <strong>the same code takes fewer lines and less indentation than with <em>google-java-format</em>,</strong> which makes it easier to read and review.</p>
<p>Moreover, the formatter makes every layout decision for us. It rebuilds each line from the code structure. So, it tidies up switches, chains, lambdas, and records the same way every time, both in the build with Spotless and in the IDE.</p><p>The post <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-palantir-formatter">Guide to Palantir Code Formatter</a> first appeared on <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com">Baeldung</a>.</p><Img align="left" border="0" height="1" width="1" alt="" style="border:0;float:left;margin:0;padding:0;width:1px!important;height:1px!important;" hspace="0" src="https://feeds.feedblitz.com/~/i/974043803/0/baeldung">
<div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/974043803/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/974043803/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f07%2fJava-Featured-11-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/974043803/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/974043803/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/974043803/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/java-palantir-formatter#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/java-palantir-formatter/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</content:encoded>
					
					<wfw:commentRss>https://feeds.feedblitz.com/~/974043803/0/baeldung/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<webfeeds:featuredImage>https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-150x150.jpg</webfeeds:featuredImage></item>
<item>
<feedburner:origLink>https://www.baeldung.com/spring-ai-2-tool-calling</feedburner:origLink>
		<title>Intro to Tool Calling in Spring AI 2.0</title>
		<link>https://feeds.feedblitz.com/~/973901774/0/baeldung</link>
					<comments>https://feeds.feedblitz.com/~/973901774/0/baeldung#respond</comments>
		
		<dc:creator><![CDATA[Polivakha Mikhail]]></dc:creator>
		<pubDate>Tue, 24 Nov 2026 11:10:02 +0000</pubDate>
				<category><![CDATA[Spring AI]]></category>
		<category><![CDATA[LLM]]></category>
		<category><![CDATA[OpenAI]]></category>
		<guid isPermaLink="false">https://www.baeldung.com/?p=205504</guid>
					<description><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/11/Spring-Boot-Featured-Image-02-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="max-width:100% !important;height:auto !important;float: left; margin-right: 5px;" loading="lazy" /><p>Learn to configure tool calling in Spring AI 2.0 and to control what tools are available and when they are allowed to execute.</p>
<p>The post <a rel="NOFOLLOW" href="https://feeds.feedblitz.com/~/973901774/0/baeldung">Intro to Tool Calling in Spring AI 2.0</a> first appeared on <a rel="NOFOLLOW" href="https://www.baeldung.com">Baeldung</a>.</p><div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/973901774/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/973901774/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f11%2fSpring-Boot-Featured-Image-02-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/973901774/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/973901774/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/973901774/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/spring-ai-2-tool-calling#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/spring-ai-2-tool-calling/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</description>
										<content:encoded><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/11/Spring-Boot-Featured-Image-02-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="float: left; margin-right: 5px;" decoding="async" loading="lazy" srcset="https://www.baeldung.com/wp-content/uploads/2024/11/Spring-Boot-Featured-Image-02-1024x536.jpg 1024w, https://www.baeldung.com/wp-content/uploads/2024/11/Spring-Boot-Featured-Image-02-300x157.jpg 300w, https://www.baeldung.com/wp-content/uploads/2024/11/Spring-Boot-Featured-Image-02-768x402.jpg 768w, https://www.baeldung.com/wp-content/uploads/2024/11/Spring-Boot-Featured-Image-02-100x52.jpg 100w, https://www.baeldung.com/wp-content/uploads/2024/11/Spring-Boot-Featured-Image-02-600x314.jpg 600w, https://www.baeldung.com/wp-content/uploads/2024/11/Spring-Boot-Featured-Image-02.jpg 1200w" sizes="auto, (max-width: 580px) 100vw, 580px" /><h2 id="bd-introduction" data-id="introduction">1. Introduction</h2>
<div class="bd-anchor" id="introduction"></div>
<p>Tool calling lets a model request an application operation by supplying a tool name and arguments. <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai">Spring AI</a> executes the tool and returns its result to the model, which can request another tool or produce an answer.</p>
<p>In Spring AI 1.x, each <em>ChatModel</em> owned its tool loop. In 2.0, <em>ToolCallingAdvisor</em> runs it within the <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai-chatclient"><em>ChatClient</em></a> advisor chain, allowing other advisors to participate. The Spring engineering article on <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/06/15/spring-ai-composable-tool-calling">composable tool calling</a> introduces this architecture.</p>
<p>We&#8217;ll build a travel assistant, compose advisors around its tool loop, and control execution manually.</p>
<h2 id="bd-maven-dependencies" data-id="maven-dependencies">2. Maven Dependencies</h2>
<div class="bd-anchor" id="maven-dependencies"></div>
<p>We&#8217;ll use the OpenAI chat model in our examples. First, let&#8217;s add the Spring AI starter:</p>
<pre><code class="language-xml" lang="xml">&lt;properties&gt;
    &lt;spring-ai.version&gt;2.0.2&lt;/spring-ai.version&gt;
&lt;/properties&gt;
&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.ai&lt;/groupId&gt;
    &lt;artifactId&gt;spring-ai-starter-model-openai&lt;/artifactId&gt;
    &lt;version&gt;${spring-ai.version}&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>
<p>The latest version of <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://mvnrepository.com/artifact/org.springframework.ai/spring-ai-starter-model-openai">spring-ai-starter-model-openai</a> is available in the Maven Repository.</p>
<p>We also need to provide the API key in <em>application.properties</em>:</p>
<pre><code class="language-properties" lang="properties">spring.ai.openai.api-key=${OPENAI_API_KEY}
</code></pre>
<p>The same tool API works with other chat models that support tool calling.</p>
<h2 id="bd-defining-tools" data-id="defining-tools">3. Defining Tools</h2>
<div class="bd-anchor" id="defining-tools"></div>
<h3 id="bd-1-defining-tool-methods" data-id="1-defining-tool-methods">3.1. Defining Tool Methods</h3>
<div class="bd-anchor" id="1-defining-tool-methods"></div>
<p>We can define a tool by annotating a method with <em>@Tool</em>. Spring AI derives the tool name, description, and JSON input schema from the method signature.</p>
<p>Let&#8217;s start with a weather tool:</p>
<pre><code class="language-java" lang="java">@Component
public class WeatherTools {
    private final WeatherService weatherService;
    public WeatherTools(WeatherService weatherService) {
        this.weatherService = weatherService;
    }
    @Tool(description = "Get the current weather in a city")
    public WeatherForecast getCurrentWeather(
      @ToolParam(description = "City name, for example Amsterdam") String city) {
        return weatherService.getCurrentWeather(city);
    }
}
</code></pre>
<p>The model uses the tool description to select a method. <em>@ToolParam</em> describes each argument.</p>
<p>Next, let&#8217;s define a booking tool that changes application state:</p>
<pre><code class="language-java" lang="java">@Component
public class BookingTools {
    private final BookingService bookingService;
    public BookingTools(BookingService bookingService) {
        this.bookingService = bookingService;
    }
    @Tool(description = "Book a one-way flight")
    public BookingConfirmation bookFlight(
      @ToolParam(description = "IATA code of the departure airport") String origin,
      @ToolParam(description = "IATA code of the destination airport") String destination,
      @ToolParam(description = "Travel date in ISO-8601 format") LocalDate date) {
        return bookingService.book(origin, destination, date);
    }
}
</code></pre>
<p>We&#8217;ll return small <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-record-keyword">records</a> with only the fields the model needs:</p>
<pre><code class="language-java" lang="java">public record WeatherForecast(String city, String conditions, int temperatureCelsius) {
}
public record BookingConfirmation(
  String reference, String flightNumber, LocalDate date) {
}
</code></pre>
<p>Spring AI serializes these results for the model; descriptive field names preserve each value&#8217;s meaning.</p>
<h3 id="bd-2-registering-default-and-per-call-tools" data-id="2-registering-default-and-per-call-tools">3.2. Registering Default and Per-Call Tools</h3>
<div class="bd-anchor" id="2-registering-default-and-per-call-tools"></div>
<p>Checking the weather is a read-only operation. Booking changes application state. We expose the weather tool by default and add the booking tool only to calls that need it:</p>
<pre><code class="language-java" lang="java">@Bean
ChatClient travelChatClient(ChatClient.Builder builder, WeatherTools weatherTools) {
    return builder
      .defaultTools(weatherTools)
      .build();
}
</code></pre>
<p>In our service, <em>planTrip()</em> adds the booking tool to every call it makes. Section 6 shows how to require approval before executing the tool:</p>
<pre><code class="language-java" lang="java">public String planTrip(String request) {
    return chatClient.prompt()
      .system("Help the user plan a trip. Never book a flight without an explicit request.")
      .user(request)
      .tools(bookingTools)
      .call()
      .content();
}
</code></pre>
<p>Spring AI appends per-call tools to the default tools; they do not replace them. Consequently, this request can use both <em>getCurrentWeather()</em> and <em>bookFlight()</em>.</p>
<h3 id="bd-3-following-a-complete-request" data-id="3-following-a-complete-request">3.3. Following a Complete Request</h3>
<div class="bd-anchor" id="3-following-a-complete-request"></div>
<p>For example, given the request:</p>
<pre><code class="language-text" lang="text">Check the weather in Amsterdam. If it is sunny, book a flight from LHR
to AMS for 2026-11-12.
</code></pre>
<p>the model can first request <em>getCurrentWeather()</em>. If its result reports sunny weather, the next model response can request <em>bookFlight()</em>. A possible final response is:</p>
<pre><code class="language-text" lang="text">Amsterdam is sunny and 18°C. I booked flight BA432 from LHR to AMS
for November 12, 2026. The booking reference is A7KF21.
</code></pre>
<p>The model chooses the wording and tool sequence; our services supply the results.</p>
<h2 id="bd-how-the-tool-calling-loop-works" data-id="how-the-tool-calling-loop-works">4. How the Tool-Calling Loop Works</h2>
<div class="bd-anchor" id="how-the-tool-calling-loop-works"></div>
<p><em>DefaultChatClient</em> automatically adds one <em>ToolCallingAdvisor</em> to the advisor chain. We normally don&#8217;t need to construct it ourselves.</p>
<p>For our travel request, the advisor performs the following steps:</p>
<ol>
<li>It sends the user message, system message, and available tool definitions to the model.</li>
<li>It inspects the model response for tool calls.</li>
<li><em>ToolCallingManager</em> resolves and executes every requested <em>ToolCallback</em>.</li>
<li>It appends the model&#8217;s request and the tool results to the conversation history.</li>
<li>It calls the model again with that history.</li>
</ol>
<p>The loop stops when the model returns no tool calls. Our example may require three model invocations: weather selection, booking selection, and the final answer.</p>
<p>In <em>ToolCallingLoopUnitTest</em>, <em>ScriptedChatModel</em> replays two tool requests and a final answer without contacting an LLM. After the travel request, we verify:</p>
<pre><code class="language-java" lang="java">assertThat(answer).isEqualTo("Amsterdam is sunny. Your flight is booked.");
assertThat(chatModel.getPrompts()).hasSize(3);
</code></pre>
<p>The model can only request callbacks we register. Our Java services still handle validation, authorization, transactions, and auditing.</p>
<p>The loop supports both <em>.call()</em> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai-chatclient-stream-response"><em>.stream()</em></a>. <em>DefaultChatClient</em> permits at most one <em>ToolAdvisor</em>, preventing duplicate tool execution.</p>
<h2 id="bd-composing-advisors-with-the-tool-loop" data-id="composing-advisors-with-the-tool-loop">5. Composing Advisors With the Tool Loop</h2>
<div class="bd-anchor" id="composing-advisors-with-the-tool-loop"></div>
<p>With the loop in the <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai-advisors">advisor chain</a>, we can observe its iterations through other advisors. We control their visibility through ordering.</p>
<p><em>ToolCallingAdvisor.DEFAULT_ORDER</em> is <em>Ordered.HIGHEST_PRECEDENCE + 300</em>. An advisor with a lower order wraps the tool advisor and runs outside the loop. An advisor with a higher order sits downstream and runs once for every model invocation.</p>
<h3 id="bd-1-observing-every-iteration" data-id="1-observing-every-iteration">5.1. Observing Every Iteration</h3>
<div class="bd-anchor" id="1-observing-every-iteration"></div>
<p>Suppose we want to record every model response, including intermediate tool-call requests. We can implement a regular <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai-recursive-advisors"><em>CallAdvisor</em></a> and place it inside the loop:</p>
<pre><code class="language-java" lang="java">public class ToolIterationLoggingAdvisor implements CallAdvisor {
    private static final Logger log =
      LoggerFactory.getLogger(ToolIterationLoggingAdvisor.class);
    @Override
    public String getName() {
        return ToolIterationLoggingAdvisor.class.getSimpleName();
    }
    @Override
    public int getOrder() {
        return ToolCallingAdvisor.DEFAULT_ORDER + 100;
    }
    @Override
    public ChatClientResponse adviseCall(
      ChatClientRequest request, CallAdvisorChain chain) {
        ChatClientResponse response = chain.nextCall(request);
        log.info("Tool-loop response: {}", response.chatResponse());
        return response;
    }
}
</code></pre>
<p>Next, we register it on the client:</p>
<pre><code class="language-java" lang="java">@Bean
ChatClient travelChatClient(
  ChatClient.Builder builder, WeatherTools weatherTools) {
    return builder
      .defaultTools(weatherTools)
      .defaultAdvisors(new ToolIterationLoggingAdvisor())
      .build();
}
</code></pre>
<p>The caller receives the final answer, while our logging advisor observes every iteration. An order below <em>ToolCallingAdvisor.DEFAULT_ORDER</em> would expose only the final response.</p>
<p><em>ToolCallingLoopUnitTest</em> uses <em>RecordingAdvisor</em>, a helper that collects responses after <em>chain.nextCall()</em>. We register two instances around the tool advisor:</p>
<pre><code class="language-java" lang="java">RecordingAdvisor outer = new RecordingAdvisor(
  "outer", ToolCallingAdvisor.DEFAULT_ORDER - 100);
RecordingAdvisor inner = new RecordingAdvisor(
  "inner", ToolCallingAdvisor.DEFAULT_ORDER + 100);
</code></pre>
<p>After the scripted weather-and-booking request, we verify which responses each advisor sees:</p>
<pre><code class="language-java" lang="java">assertThat(outer.getResponses()).hasSize(1);
assertThat(inner.getResponses()).hasSize(3);
assertThat(inner.getResponses())
  .extracting(response -&gt; response.chatResponse().hasToolCalls())
  .containsExactly(true, true, false);
</code></pre>
<p>This example uses <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-boot-logging">SLF4J with Logback through Spring Boot</a>. In production, we should redact sensitive tool arguments and results. The same ordering rule applies to metrics and policy checks.</p>
<h3 id="bd-2-memory-inside-and-outside-the-loop" data-id="2-memory-inside-and-outside-the-loop">5.2. Memory Inside and Outside the Loop</h3>
<div class="bd-anchor" id="2-memory-inside-and-outside-the-loop"></div>
<p>The default <em>MessageChatMemoryAdvisor</em> order is <em>Ordered.HIGHEST_PRECEDENCE + 200</em>, so <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai-chat-memory">memory</a> stays outside the tool loop. It loads history once and stores the user&#8217;s message together with the final answer. <em>ToolCallingAdvisor</em> maintains intermediate tool requests and responses in its internal history.</p>
<p>In <em>ChatMemoryPlacementUnitTest</em>, we script one weather call and a final answer. With default memory ordering, we verify:</p>
<pre><code class="language-java" lang="java">assertThat(chatMemory.get(CONVERSATION_ID))
  .extracting(Message::getMessageType)
  .containsExactly(MessageType.USER, MessageType.ASSISTANT);
</code></pre>
<p>We can place memory inside the loop when subsequent user turns need the full tool transcript:</p>
<pre><code class="language-java" lang="java">MessageChatMemoryAdvisor memoryAdvisor = MessageChatMemoryAdvisor
  .builder(chatMemory)
  .order(ToolCallingAdvisor.DEFAULT_ORDER + 100)
  .build();
</code></pre>
<p>When we repeat the request with this ordering, memory also stores the assistant&#8217;s tool request and the tool result:</p>
<pre><code class="language-java" lang="java">assertThat(chatMemory.get(CONVERSATION_ID))
  .extracting(Message::getMessageType)
  .containsExactly(MessageType.USER, MessageType.ASSISTANT,
    MessageType.TOOL, MessageType.ASSISTANT);
</code></pre>
<p>With an auto-registered tool advisor, <em>DefaultChatClient</em> notices this arrangement and disables the advisor&#8217;s internal conversation history. Otherwise, both components would maintain the same messages. When we construct <em>ToolCallingAdvisor</em> manually, we need to call <em>disableInternalConversationHistory()</em> ourselves.</p>
<p>We need a memory repository that supports tool request and response messages. The <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://docs.spring.io/spring-ai/reference/api/tools.html#backend-compatibility">backend compatibility documentation</a> lists in-memory, Redis, and Neo4j as supporting the full message set in 2.0. Otherwise, we should keep memory outside the loop.</p>
<h2 id="bd-controlling-tool-execution-ourselves" data-id="controlling-tool-execution-ourselves">6. Controlling Tool Execution Ourselves</h2>
<div class="bd-anchor" id="controlling-tool-execution-ourselves"></div>
<p>For approval workflows or custom stop conditions, we can disable automatic execution per request.</p>
<h3 id="bd-1-preparing-a-request-for-manual-execution" data-id="1-preparing-a-request-for-manual-execution">6.1. Preparing a Request for Manual Execution</h3>
<div class="bd-anchor" id="1-preparing-a-request-for-manual-execution"></div>
<p>We&#8217;ll pass the question and a booking approval predicate to our service method:</p>
<pre><code class="language-java" lang="java">public String planTrip(String question, Predicate&lt;ToolCall&gt; bookingApprover) {
</code></pre>
<p>Inside this method, we prepare the callbacks and chat options:</p>
<pre><code class="language-java" lang="java">ToolCallingManager toolCallingManager = ToolCallingManager.builder().build();
ToolCallback[] callbacks = ToolCallbacks.from(weatherTools, bookingTools);
ToolCallingChatOptions options = ToolCallingChatOptions.builder()
  .toolCallbacks(callbacks)
  .build();
Prompt prompt = new Prompt(List.of(new UserMessage(question)), options);
</code></pre>
<p>Then, we make the initial call without automatic tool execution:</p>
<pre><code class="language-java" lang="java">ChatClientResponse response = chatClient.prompt()
  .messages(prompt.getInstructions())
  .options(options.mutate())
  .advisors(AdvisorParams.toolCallingAdvisorAutoRegister(false))
  .call()
  .chatClientResponse();
</code></pre>
<h3 id="bd-2-executing-and-continuing-the-loop" data-id="2-executing-and-continuing-the-loop">6.2. Executing and Continuing the Loop</h3>
<div class="bd-anchor" id="2-executing-and-continuing-the-loop"></div>
<p>Spring AI still sends the tools to the model, but the application now receives the model&#8217;s tool-call response. We can inspect it, request approval when necessary, and continue the loop through <em>ToolCallingManager</em>:</p>
<pre><code class="language-java" lang="java">while (response.chatResponse() != null
  &amp;&amp; response.chatResponse().hasToolCalls()) {
    approveIfRequired(response.chatResponse(), bookingApprover);
    ToolExecutionResult result = toolCallingManager
      .executeToolCalls(prompt, response.chatResponse());
    prompt = new Prompt(result.conversationHistory(), options);
    response = chatClient.prompt()
      .messages(result.conversationHistory())
      .options(options.mutate())
      .advisors(AdvisorParams.toolCallingAdvisorAutoRegister(false))
      .call()
      .chatClientResponse();
}
</code></pre>
<p><em>approveIfRequired()</em> checks booking calls against <em>bookingApprover</em> and throws <em>BookingNotApprovedException</em> if approval fails. Weather lookups need no approval. We own history and termination; we can use an advisor inside the automatic loop when we only need observation.</p>
<p>Our two tools use the default <em>returnDirect = false</em>. In a general-purpose manual loop, we must also inspect <em>result.returnDirect()</em> after execution. When it is <em>true</em>, we must treat the tool output as the final response and avoid sending it to the model again; <em>ToolExecutionResult.buildGenerations(result)</em> converts it into response generations.</p>
<h2 id="bd-further-considerations" data-id="further-considerations">7. Further Considerations</h2>
<div class="bd-anchor" id="further-considerations"></div>
<p>Large <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai-model-context-protocol-mcp">MCP</a> registries can consume substantial context with tool schemas. <em>ToolSearchToolCallingAdvisor</em> replaces the regular tool advisor and discovers tools progressively. The advisor searches a tool index. Our <em>tool-search</em> profile uses Lucene for keyword search. We can also use a regex-based index for pattern matching or a vector store for <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai-pgvector-semantic-search">semantic search</a>.</p>
<p>The <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://docs.spring.io/spring-ai/reference/upgrade-notes.html#tool-calling-1x-to-2x">2.0 tool-calling upgrade notes</a> explain how to replace model-level execution settings with advisor configuration. For <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai-mistral-api-function-calling">function-style tools</a>, we now register explicit <em>ToolCallback</em> instances rather than resolving function beans by name. Our examples use the 2.0 APIs.</p>
<h2 id="bd-conclusion" data-id="conclusion">8. Conclusion</h2>
<div class="bd-anchor" id="conclusion"></div>
<p>We defined tools, followed the execution loop, and used advisor ordering to observe iterations and manage memory. Manual execution gives us control when operations require approval.</p>
<p>The code backing this article is available <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/eugenp/tutorials/tree/master/spring-ai-modules/spring-ai-tool-calling">over on GitHub</a>.</p><p>The post <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai-2-tool-calling">Intro to Tool Calling in Spring AI 2.0</a> first appeared on <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com">Baeldung</a>.</p><Img align="left" border="0" height="1" width="1" alt="" style="border:0;float:left;margin:0;padding:0;width:1px!important;height:1px!important;" hspace="0" src="https://feeds.feedblitz.com/~/i/973901774/0/baeldung">
<div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/973901774/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/973901774/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f11%2fSpring-Boot-Featured-Image-02-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/973901774/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/973901774/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/973901774/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/spring-ai-2-tool-calling#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/spring-ai-2-tool-calling/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</content:encoded>
					
					<wfw:commentRss>https://feeds.feedblitz.com/~/973901774/0/baeldung/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<webfeeds:featuredImage>https://www.baeldung.com/wp-content/uploads/2024/11/Spring-Boot-Featured-Image-02-150x150.jpg</webfeeds:featuredImage></item>
<item>
<feedburner:origLink>https://www.baeldung.com/java-weekly-672</feedburner:origLink>
		<title>Java Weekly, Issue 672</title>
		<link>https://feeds.feedblitz.com/~/973557479/0/baeldung</link>
					<comments>https://feeds.feedblitz.com/~/973557479/0/baeldung#respond</comments>
		
		<dc:creator><![CDATA[baeldung]]></dc:creator>
		<pubDate>Fri, 20 Nov 2026 21:31:59 +0000</pubDate>
				<category><![CDATA[Weekly Review]]></category>
		<category><![CDATA[no-ads]]></category>
		<category><![CDATA[no-after-post]]></category>
		<category><![CDATA[no-before-post]]></category>
		<category><![CDATA[no-optins]]></category>
		<guid isPermaLink="false">https://www.baeldung.com/?p=205494</guid>
					<description><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="max-width:100% !important;height:auto !important;float: left; margin-right: 5px;" loading="lazy" /><p>Some simple Maven wins and an interesting piece on testing in the agentic era.</p>
<p>The post <a rel="NOFOLLOW" href="https://feeds.feedblitz.com/~/973557479/0/baeldung">Java Weekly, Issue 672</a> first appeared on <a rel="NOFOLLOW" href="https://www.baeldung.com">Baeldung</a>.</p><div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/973557479/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/973557479/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2016%2f10%2fsocial-Weekly-Reviews-4.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/973557479/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/973557479/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/973557479/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/java-weekly-672#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/java-weekly-672/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</description>
										<content:encoded><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="float: left; margin-right: 5px;" decoding="async" loading="lazy" srcset="https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4.jpg 952w, https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4-300x157.jpg 300w, https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4-768x402.jpg 768w" sizes="auto, (max-width: 580px) 100vw, 580px" /><h2 style="text-align: left;" id="bd-spring-and-java" data-id="spring-and-java">1.<strong> Spring and Java</strong></h2>
<div class="bd-anchor" id="spring-and-java"></div>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/comparing-java-formatters-why-open-java-format-is-my-new-favorite/">&gt;&gt; Comparing Java Formatters: Why Open Java Format Is My New Favorite</a></strong> [<span style="color: #993300;">foojay.io</span>]</p>
<p>Java never shipped a built-in formatter, so we do have choices. Here&#8217;s five formatters through JDK 25 and a 1,000-line showcase of modern Java &#8211; the side-by-side output for lambdas, streams, switch expressions and text blocks is telling.</p>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/giving-ai-agents-live-observability-into-a-jvm-runtime-with-mcp/">&gt;&gt; Giving AI Agents Live Observability into a JVM Runtime with MCP</a></strong> [<span style="color: #993300;">foojay.io</span>]</p>
<p>An agent that can write code but cannot see the runtime is guessing about production. In their stress demo, one conversation took the agent from &#8220;feels slow&#8221; to the offending query. Interesting.</p>
<h4><strong>Also worth reading:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/java4shell-cve-2026-114938-what-it-is-who-is-affected-and-what-to-do-now/" target="_blank" rel="noopener"><strong>Java4Shell (CVE-2026-114938): What It Is, Who Is Affected, and What to Do Now</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/spring-boot-jpa-vs-jdbc/" target="_blank" rel="noopener"><strong>Spring Boot JPA vs JDBC: How Much Can a Small App Save?</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/java-27-whats-new/" target="_blank" rel="noopener"><strong>Java 27: What’s New?</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://quarkus.io/blog/quarkus-resiliency-testing/" target="_blank" rel="noopener"><strong>Break your dependencies on purpose: introducing Quarkus Resiliency Testing</strong></a> [<span style="color: #800000;">quarkus.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://quarkus.io/blog/ai-root-cause-analysis-deep-dive/" target="_blank" rel="noopener"><strong>AI Root Cause Analysis: Architecture, Testing, and Evaluation</strong></a> [<span style="color: #800000;">quarkus.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/jakarta-ee-testing-tools-compared-weldinitiator-arquillian-and-testcontainers/" target="_blank" rel="noopener"><strong>Jakarta EE Testing Tools Compared: WeldInitiator, Arquillian and Testcontainers</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.wimdeblauwe.com/blog/2026/11/16/building-an-application-with-shadleaf/" target="_blank" rel="noopener"><strong>Building an application with Shadleaf</strong></a> [<span style="color: #800000;">wimdeblauwe.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/who-is-actually-turning-your-java-object-into-json/" target="_blank" rel="noopener"><strong>Who Is Actually Turning Your Java Object Into JSON?</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/5-jvm-heap-oom-patterns/" target="_blank" rel="noopener"><strong>5 JVM Heap OOM Patterns You Can Reproduce on Your Laptop</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/jsr-381-java-visual-recognition-api/" target="_blank" rel="noopener"><strong>An Introduction to JSR 381, the Java Visual Recognition API</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/analytics-in-the-browser-with-duckdb-wasm/" target="_blank" rel="noopener"><strong>Analytics in the Browser with DuckDB-Wasm and a Java Backend</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
</ul>
<h4><strong>Webinars and presentations:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://inside.java/2026/11/16/devoxxbelgium-valhalla-value-objects/" target="_blank" rel="noopener"><strong>Why It Takes 3000 Commits to Bring Valhalla’s Value Objects to the JDK</strong></a> [<span style="color: #800000;">inside.java</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://inside.java/newscast/117/" target="_blank" rel="noopener"><strong>Adaptive Heap Sizing + Numeric Conversion + Primitive Patterns &#8211; Inside Java Newscast #117</strong></a> [<span style="color: #800000;">inside.java</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/foojay-podcast-105/" target="_blank" rel="noopener"><strong>Foojay Podcast #105: Security Is Your Job: OWASP, AI and Safer Java Dependencies with Jim Manico</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/12/a-bootiful-podcast-guy-pardon" target="_blank" rel="noopener"><strong>A Bootiful Podcast: Atomikos founder Guy Pardon on distributed transactions, data integrity, and more</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/16/spring-office-hours-podcast-S5E30" target="_blank" rel="noopener"><strong>Spring Office Hours Podcast: S5E30 &#8211; What’s New in IntelliJ IDEA and AIR with Anton Arhipov</strong></a> [<span style="color: #800000;">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.infoq.com/podcasts/company-closer-digital-sovereignty/" target="_blank" rel="noopener"><strong>Getting CRA Compliant Hardens the Code and Gets Your Company Closer to Digital Sovereignty</strong></a> [<span style="color: #800000;">infoq.com</span>]</li>
</ul>
<h4><strong>Time to upgrade:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://in.relation.to/2026/11/12/orm-80-cr1/" target="_blank" rel="noopener"><strong>Hibernate 8.0.0.CR1</strong></a> [<span style="color: #800000;">relation.to</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://in.relation.to/2026/11/17/hibernate-reactive-5_1_0_CR2/" target="_blank" rel="noopener"><strong>Hibernate Reactive 5.1.0.CR2 and 5.0.0.CR2 released</strong></a> [<span style="color: #800000;">relation.to</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://inside.java/2026/11/12/announcing-oracle-weblogic-server-and-coherence-26/" target="_blank" rel="noopener"><strong>Announcing Oracle WebLogic Server and Coherence 26</strong></a> [<span style="color: #800000;">inside.java</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/whats-new-in-the-november-2026-azul-payara-release/" target="_blank" rel="noopener"><strong>What&#8217;s New In The November 2026 Azul Payara Release?</strong></a> [<span style="color: #800000;">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> Quarkus <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/quarkusio/quarkus/releases/tag/4.0.0" target="_blank" rel="noopener"><strong>4.0.0</strong></a> [<span style="color: #800000;">github.com/quarkusio</span>]</li>
<li><strong>&gt;&gt;</strong> Micronaut Core <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/micronaut-projects/micronaut-core/releases/tag/v5.2.25" target="_blank" rel="noopener"><strong>5.2.25</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/micronaut-projects/micronaut-core/releases/tag/v5.2.24" target="_blank" rel="noopener"><strong>5.2.24</strong></a> [<span style="color: #800000;">github.com/micronaut-projects</span>]</li>
<li><strong>&gt;&gt;</strong> Helidon <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/helidon-io/helidon/releases/tag/27.0.2" target="_blank" rel="noopener"><strong>27.0.2</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/helidon-io/helidon/releases/tag/4.5.7" target="_blank" rel="noopener"><strong>4.5.7</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/helidon-io/helidon/releases/tag/3.2.23" target="_blank" rel="noopener"><strong>3.2.23</strong></a> [<span style="color: #800000;">github.com/helidon-io</span>]</li>
<li><strong>&gt;&gt;</strong> Maven <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/apache/maven/releases/tag/maven-3.10.1" target="_blank" rel="noopener"><strong>3.10.1</strong></a> [<span style="color: #800000;">github.com/apache</span>]</li>
<li><strong>&gt;&gt;</strong> MicroProfile <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/microprofile/microprofile/releases/tag/7.2" target="_blank" rel="noopener"><strong>7.2</strong></a> [<span style="color: #800000;">github.com/microprofile</span>]</li>
</ul>
<h2 style="text-align: left;" id="bd-technical-amp-musings" data-id="technical-amp-musings">2.<strong> Technical &amp; Musings</strong></h2>
<div class="bd-anchor" id="technical-amp-musings"></div>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://martinfowler.com/articles/data-contracts.html">&gt;&gt; Data Contracts</a></strong> [<span style="color: #993300;">martinfowler.com</span>]</p>
<p>Data contracts bring API-design discipline to datasets: a machine-readable, versioned description of schema, quality rules, SLAs, ownership and terms of use. The Open Data Contract Standard. And of course, an AI agent will love this <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<h4><strong>Also worth reading:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://martinfowler.com/articles/deterministic-simulation-testing.html" target="_blank" rel="noopener"><strong>Deterministic Simulation Testing</strong></a> [<span style="color: #800000;">martinfowler.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://martinfowler.com/bliki/GeneratedGlossary.html" target="_blank" rel="noopener"><strong>Generated Glossary</strong></a> [<span style="color: #800000;">martinfowler.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://netflixtechblog.com/engineering-ai-discover-e244944cdc38" target="_blank" rel="noopener"><strong>Engineering AI Discover</strong></a> [<span style="color: #800000;">netflixtechblog.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.petrikainulainen.net/uncategorized/embracing-static-html-why-and-how-i-left-wordpress-behind/" target="_blank" rel="noopener"><strong>Embracing Static HTML: Why and How I Left WordPress Behind</strong></a> [<span style="color: #800000;">petrikainulainen.net</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.scottlogic.com/2026/11/16/will-ai-make-legacy-a-thing-of-the-past.html" target="_blank" rel="noopener"><strong>Beyond the Hype: Will AI make legacy a thing of the past?</strong></a> [<span style="color: #800000;">scottlogic.com</span>]</li>
</ul>
<h2 style="text-align: left;" id="bd-pick-of-the-week" data-id="pick-of-the-week">3.<strong> Pick of the Week</strong></h2>
<div class="bd-anchor" id="pick-of-the-week"></div>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://x.com/clamanna/status/2122209697226948729">&gt;&gt; Microsoft Outgate Postmortem</a></strong> [<span style="color: #993300;">x.com</span>]</p><p>The post <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-weekly-672">Java Weekly, Issue 672</a> first appeared on <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com">Baeldung</a>.</p><Img align="left" border="0" height="1" width="1" alt="" style="border:0;float:left;margin:0;padding:0;width:1px!important;height:1px!important;" hspace="0" src="https://feeds.feedblitz.com/~/i/973557479/0/baeldung">
<div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/973557479/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/973557479/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2016%2f10%2fsocial-Weekly-Reviews-4.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/973557479/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/973557479/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/973557479/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/java-weekly-672#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/java-weekly-672/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</content:encoded>
					
					<wfw:commentRss>https://feeds.feedblitz.com/~/973557479/0/baeldung/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<webfeeds:featuredImage>https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4-150x150.jpg</webfeeds:featuredImage></item>
<item>
<feedburner:origLink>https://www.baeldung.com/junit-6-system-properties-extension</feedburner:origLink>
		<title>A Guide to the System Properties Extension Annotations in JUnit 6.1</title>
		<link>https://feeds.feedblitz.com/~/973461452/0/baeldung</link>
					<comments>https://feeds.feedblitz.com/~/973461452/0/baeldung#respond</comments>
		
		<dc:creator><![CDATA[Emanuel Trandafir]]></dc:creator>
		<pubDate>Thu, 19 Nov 2026 23:40:23 +0000</pubDate>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[JUnit 6]]></category>
		<guid isPermaLink="false">https://www.baeldung.com/?p=205452</guid>
					<description><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/11/Testing-Featured-Image-01-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="max-width:100% !important;height:auto !important;float: left; margin-right: 5px;" loading="lazy" /><p>Learn about the System Properties Extension annotations introduced in JUnit 6.1, which work together to clear, set, and restore JVM system properties between unit test runs.</p>
<p>The post <a rel="NOFOLLOW" href="https://feeds.feedblitz.com/~/973461452/0/baeldung">A Guide to the System Properties Extension Annotations in JUnit 6.1</a> first appeared on <a rel="NOFOLLOW" href="https://www.baeldung.com">Baeldung</a>.</p><div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/973461452/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/973461452/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f11%2fTesting-Featured-Image-01-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/973461452/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/973461452/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/973461452/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/junit-6-system-properties-extension#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/junit-6-system-properties-extension/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</description>
										<content:encoded><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/11/Testing-Featured-Image-01-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="float: left; margin-right: 5px;" decoding="async" loading="lazy" srcset="https://www.baeldung.com/wp-content/uploads/2024/11/Testing-Featured-Image-01-1024x536.jpg 1024w, https://www.baeldung.com/wp-content/uploads/2024/11/Testing-Featured-Image-01-300x157.jpg 300w, https://www.baeldung.com/wp-content/uploads/2024/11/Testing-Featured-Image-01-768x402.jpg 768w, https://www.baeldung.com/wp-content/uploads/2024/11/Testing-Featured-Image-01-100x52.jpg 100w, https://www.baeldung.com/wp-content/uploads/2024/11/Testing-Featured-Image-01-600x314.jpg 600w, https://www.baeldung.com/wp-content/uploads/2024/11/Testing-Featured-Image-01.jpg 1200w" sizes="auto, (max-width: 580px) 100vw, 580px" /><h2 id="bd-overview" data-id="overview">1. Overview</h2>
<div class="bd-anchor" id="overview"></div>
<p>System properties live in a global, shared map on the JVM. <strong>When a test sets a property with <em>System.setProperty()</em>, that change persists for the entire test run unless the test explicitly restores the original value</strong>. This can lead to subtle test pollution: a passing test can silently corrupt state, causing a completely unrelated test to fail and resulting in flaky behavior.</p>
<p>In this article, <strong>we&#8217;ll explore a JUnit extension that helps us manage system properties declaratively and avoid flaky tests</strong>. We&#8217;ll start with <em>@SetSystemProperty</em> and <em>@ClearSystemProperty</em>, which are helpful for setting or removing properties for individual tests or test classes. Finally, we&#8217;ll discover <em>@RestoreSystemProperties</em> and use it to restore all system properties set during a specific test or class.</p>
<h2 id="bd-setting-and-clearing-properties" data-id="setting-and-clearing-properties">2. Setting and Clearing Properties</h2>
<div class="bd-anchor" id="setting-and-clearing-properties"></div>
<p>Let&#8217;s imagine a simple use case where one test needs a special system property, say &#8220;<em>app.mode</em>&#8221; to be set to &#8220;<em>debug</em>&#8220;. A common pattern is to use the <em>java.lang.System</em>&#8216;s API to set the property we need at the beginning of the test:</p>
<pre><code class="language-java">@Test
void whenSetProperty_thenLeaksToNextTest() {
    System.setProperty("app.mode", "debug");
    assertThat(System.getProperty("app.mode"))
      .isEqualTo("debug");
}
@Test // &lt;-- flaky test!
void whenPropertyNotSet_thenShouldBeNull() {
    assertThat(System.getProperty("app.mode"))
      .isNull();
}</code></pre>
<p>However,<strong> this approach creates side effects that can affect other tests</strong>. In our case, it&#8217;ll make <em>whenPropertyNotSet_thenShouldBeNull()</em> test flaky: it can now either pass or fail, depending on the execution order of the two. One way to fix this would be to clear the &#8220;<em>app.mode</em>&#8221; property before each test, creating a clean environment for each test execution.</p>
<h3 id="bd-1-method-level-annotations" data-id="1-method-level-annotations">2.1. Method-Level Annotations</h3>
<div class="bd-anchor" id="1-method-level-annotations"></div>
<p><strong>JUnit 6.1 introduces a built-in extension that helps us manage system properties in a declarative way</strong>. For instance, a test that specifically needs a system property to be set can now use the <em>@SetSystemProperty</em> annotation:</p>
<pre><code class="language-java">@Test
@SetSystemProperty(key = "app.mode", value = "debug")
void givenSetPropertyAnnotation_whenGetProperty_thenReturnsValue() {
    assertThat(System.getProperty("app.mode"))
      .isEqualTo("debug");
}</code></pre>
<p>On the other hand, <strong>we can use <em>@ClearSystemProperty</em> to easily remove a system property</strong>:</p>
<pre><code class="language-java">@Test
@ClearSystemProperty(key = "app.mode")
void whenNoProperty_thenGetPropertyShouldReturnNull() {
    assertThat(System.getProperty("app.mode"))
      .isNull();
}</code></pre>
<h3 id="bd-2-repeatable-annotations" data-id="2-repeatable-annotations">2.2. Repeatable Annotations</h3>
<div class="bd-anchor" id="2-repeatable-annotations"></div>
<p>Furthermore, <strong>the <em>@SetSystemProperty</em> and <em>@ClearSystemProperty</em> annotations can be used together or repeated multiple times</strong>. For instance, let&#8217;s assume we want to clear the &#8220;<em>app.host</em>&#8221; and &#8220;<em>app.port</em>&#8221; properties and set &#8220;<em>app.mode</em>&#8221; only:</p>
<pre><code class="language-java">@Test
@ClearSystemProperty(key = "app.host")
@ClearSystemProperty(key = "app.port")
@SetSystemProperty(key = "app.mode", value = "staging")
void givenRepeatableAnnotations_whenGetProperties_thenExpectedValues() {
    assertThat(System.getProperty("app.host"))
      .isNull();
    assertThat(System.getProperty("app.port"))
      .isNull();
    assertThat(System.getProperty("app.mode"))
      .isEqualTo("staging");
}</code></pre>
<h3 id="bd-3-class-level-annotations" data-id="3-class-level-annotations">2.3. Class-Level Annotations</h3>
<div class="bd-anchor" id="3-class-level-annotations"></div>
<p>If we notice we keep using the same setup and cleanup annotations on every test in a class, we can move them to the class level. <strong>The extension applies them to each test method in the class</strong>, so we avoid repeating ourselves:</p>
<pre><code class="language-java">@SetSystemProperty(key = "app.mode", value = "staging")
@ClearSystemProperty(key = "app.host")
class ClassLevelSystemPropertiesUnitTest {
    // ...
}</code></pre>
<p>Moreover, even when the class is annotated,<strong> we can still override a system property for a specific test by using a method-level annotation</strong>. In our case, let&#8217;s say one test needs <em>app.mode</em> to be set to <em>&#8220;debug&#8221;</em> instead:</p>
<pre><code class="language-java">@Test
@SetSystemProperty(key = "app.mode", value = "debug")
void givenMethodLevelAnnotation_whenGetProperty_thenOverridesClassLevel() {
    assertThat(System.getProperty("app.mode"))
      .isEqualTo("debug");
}</code></pre>
<p>As expected, the method-level annotation takes precedence for this test only. The other tests in the class still see the class-level value, <em>&#8220;staging&#8221;</em>.</p>
<h2 id="bd-restoring-properties-set-in-code" data-id="restoring-properties-set-in-code">3. Restoring Properties Set in Code</h2>
<div class="bd-anchor" id="restoring-properties-set-in-code"></div>
<p><em>@SetSystemProperty</em> and <em>@ClearSystemProperty</em> work well when the property values are known upfront, but sometimes a test needs to set properties dynamically: for example, based on parameters or runtime conditions. For those cases<strong>, JUnit 6.1 provides <em>@RestoreSystemProperties</em>, which guarantees restoring the properties to their original state once the test finishes</strong>.</p>
<p>Let&#8217;s imagine testing a function that may set system properties the test is not aware of.</p>
<pre><code class="language-java">@Test
void whenCallingTestedFunction_thenReturnsNotEmptyString() {
    String result = testedFunction();
    assertThat(result).isNotEmpty();
}
static String testedFunction() {
    String randomString = UUID.randomUUID().toString();
    System.setProperty(randomString, "dummy-value");
    return "done";
}</code></pre>
<p>Cleaning up after such tests can get tedious. Luckily, <strong><em>@RestoreSystemProperties</em> solves this by automatically reverting all system properties to their original state after the test completes</strong>:</p>
<pre><code class="language-java">@Test
@RestoreSystemProperties
void whenCallingTestedFunction_thenReturnsNotEmptyString() {
    // ...
}</code></pre>
<p>As we can see, applied at the method level, each test gets its own isolated snapshot. Moreover, <strong>we can also apply it at the class level, which has the same effect as annotating every test method in the class</strong>: each test gets its own snapshot and restores the properties when it finishes.</p>
<h2 id="bd-practical-considerations" data-id="practical-considerations">4. Practical Considerations</h2>
<div class="bd-anchor" id="practical-considerations"></div>
<p>Before wrapping up, let&#8217;s look at how the extension behaves in parallel test runs and how it compares to other libraries.</p>
<h3 id="bd-1-parallel-execution" data-id="1-parallel-execution">4.1. Parallel Execution</h3>
<div class="bd-anchor" id="1-parallel-execution"></div>
<p>By default, JUnit runs tests sequentially. To speed up large test suites, we can enable <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/junit-5-parallel-tests">parallel execution</a>. However, system properties are global state shared by all threads, so <strong>reading and writing them in concurrent tests can lead to unpredictable results and flaky tests</strong>.</p>
<p dir="ltr">The extension accounts for this. <strong>Tests annotated with <em>@SetSystemProperty, @ClearSystemProperty</em>, or <em>@RestoreSystemProperties</em> never run in parallel with each other</strong>, because JUnit guards them with <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://docs.junit.org/6.1.3/writing-tests/parallel-execution.html#synchronization">resource locks</a>.</p>
<p dir="ltr">However, this doesn’t cover tests whose code reads or writes system properties without these annotations, since they can still run in parallel with the annotated ones. <strong>To address this, we can annotate them with <em>@ReadsSystemProperty</em> or <em>@WritesSystemProperty</em>, so that JUnit applies the same locks to them.</strong></p>
<h3 id="bd-2-alternatives" data-id="2-alternatives">4.2. Alternatives</h3>
<div class="bd-anchor" id="2-alternatives"></div>
<p>Managing system properties in tests isn&#8217;t new, so we may already use a library for it. Let&#8217;s see how the built-in extension compares.</p>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-unit-testing-environment-variables">JUnit Pioneer</a> offers annotations with the same names, <em>@SetSystemProperty</em> and<em> @ClearSystemProperty</em></strong>. Moving to the built-in extension is therefore mostly a matter of changing the imports and dropping the dependency, as long as we only need system properties. Pioneer remains the better choice if we&#8217;re stuck on an older JUnit version.</p>
<p>On the other hand, <strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-system-stubs">System Stubs</a> takes a different approach</strong>. Instead of annotations only, <strong>it provides stub objects that can be injected into tests and changed dynamically at runtime</strong>. It also covers more than system properties, including environment variables,<em> System.out</em>, and <em>System.exit</em> calls. If we rely on those features, we should keep it.</p>
<p>Overall, <strong>the built-in extension has no extra dependency and is part of JUnit itself</strong>. It also integrates with JUnit&#8217;s own parallel execution locking, as we saw in the previous section. So, <strong>if system properties are all we need, it&#8217;s the simplest option</strong>.</p>
<h2 id="bd-conclusion" data-id="conclusion">5. Conclusion</h2>
<div class="bd-anchor" id="conclusion"></div>
<p>In this tutorial, we discussed JUnit 6.1&#8217;s built-in system properties extension. We learned that <strong>the API offers annotations such as <em>@SetSystemProperty</em> and <em>@ClearSystemProperty</em> to manage specific system properties</strong>, and saw that we can combine or repeat them at a method or class level.</p>
<p>After that, we explored the case where the invoked test code sets system properties that we are not aware of. Therefore, we cannot simply clear them using  <em>@ClearSystemProperty</em> and the property key. For this scenario,<strong> we used <em>@RestoreSystemProperties</em> to completely reset the environment to the state prior to the test execution</strong>.</p>
<p>Finally, we looked at how the extension behaves during parallel execution, and how it compares to other libraries such as JUnit Pioneer and System Stubs.</p>
<p>As always, the full source code is available <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/eugenp/tutorials/tree/master/testing-modules/junit-6">over on GitHub</a>.</p><p>The post <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/junit-6-system-properties-extension">A Guide to the System Properties Extension Annotations in JUnit 6.1</a> first appeared on <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com">Baeldung</a>.</p><Img align="left" border="0" height="1" width="1" alt="" style="border:0;float:left;margin:0;padding:0;width:1px!important;height:1px!important;" hspace="0" src="https://feeds.feedblitz.com/~/i/973461452/0/baeldung">
<div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/973461452/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/973461452/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f11%2fTesting-Featured-Image-01-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/973461452/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/973461452/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/973461452/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/junit-6-system-properties-extension#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/junit-6-system-properties-extension/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</content:encoded>
					
					<wfw:commentRss>https://feeds.feedblitz.com/~/973461452/0/baeldung/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<webfeeds:featuredImage>https://www.baeldung.com/wp-content/uploads/2024/11/Testing-Featured-Image-01-150x150.jpg</webfeeds:featuredImage></item>
<item>
<feedburner:origLink>https://www.baeldung.com/spring-ai-anthropic-rate-limit</feedburner:origLink>
		<title>Rate Limit Information from Anthropic API Response Headers Using ChatResponseMetadata in Spring AI</title>
		<link>https://feeds.feedblitz.com/~/972994280/0/baeldung</link>
					<comments>https://feeds.feedblitz.com/~/972994280/0/baeldung#respond</comments>
		
		<dc:creator><![CDATA[Olayemi Michael]]></dc:creator>
		<pubDate>Sat, 14 Nov 2026 14:14:40 +0000</pubDate>
				<category><![CDATA[Artificial Intelligence]]></category>
		<category><![CDATA[Anthropic]]></category>
		<category><![CDATA[Spring AI ChatClient]]></category>
		<guid isPermaLink="false">https://www.baeldung.com/?p=205398</guid>
					<description><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-13-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="max-width:100% !important;height:auto !important;float: left; margin-right: 5px;" loading="lazy" /><p>Learn how to access rate limit metadata returned by Anthropic through Spring AI.</p>
<p>The post <a rel="NOFOLLOW" href="https://feeds.feedblitz.com/~/972994280/0/baeldung">Rate Limit Information from Anthropic API Response Headers Using ChatResponseMetadata in Spring AI</a> first appeared on <a rel="NOFOLLOW" href="https://www.baeldung.com">Baeldung</a>.</p><div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972994280/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972994280/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f07%2fJava-Featured-13-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972994280/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972994280/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972994280/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/spring-ai-anthropic-rate-limit#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/spring-ai-anthropic-rate-limit/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</description>
										<content:encoded><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-13-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="float: left; margin-right: 5px;" decoding="async" loading="lazy" srcset="https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-13-1024x536.jpg 1024w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-13-300x157.jpg 300w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-13-768x402.jpg 768w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-13-100x52.jpg 100w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-13.jpg 1200w" sizes="auto, (max-width: 580px) 100vw, 580px" /><h2 id="bd-overview" data-id="overview">1. Overview</h2>
<div class="bd-anchor" id="overview"></div>
<p>Spring AI<em> ChatResponseMetadata</em> class exposes metadata associated with a chat response, including information about the model and other response-related details. Depending on the provider and the metadata available, this information can also include rate limit details.</p>
<p>In this tutorial, we&#8217;ll explore how to access rate limit metadata returned by <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai-anthropic-agent-skills">Anthropic</a> through Spring AI. Also, we&#8217;ll examine how the <em>getLimit()</em> method exposes this information.</p>
<h2 id="bd-maven-dependencies" data-id="maven-dependencies">2. Maven Dependencies</h2>
<div class="bd-anchor" id="maven-dependencies"></div>
<p>To begin, let&#8217;s bootstrap a simple <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai-anthropics-claude-models">Spring Boot AI application</a> and add the <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web"><em>spring-boot-starter-web</em></a> and the <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://mvnrepository.com/artifact/org.springframework.ai/spring-ai-starter-model-anthropic"><em>spring-ai-starter-model-anthropic</em></a> dependencies to our <em>pom.xml</em>:</p>
<pre><code class="language-xml">&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.ai&lt;/groupId&gt;
    &lt;artifactId&gt;spring-ai-starter-model-anthropic&lt;/artifactId&gt;
&lt;/dependency&gt;</code></pre>
<p>The <em>spring-boot-starter-web</em> dependency provides Spring MVC and configures an embedded web server for our application. Next, <strong>the <em>spring-ai-starter-model-anthropic</em> dependency integrates Anthropic&#8217;s chat models with Spring AI</strong>. It allows us to interact with them through Spring AI abstractions.</p>
<h2 id="bd-getting-the-rate-limit-metadata" data-id="getting-the-rate-limit-metadata">3. Getting the Rate Limit Metadata</h2>
<div class="bd-anchor" id="getting-the-rate-limit-metadata"></div>
<p>First, <strong>let&#8217;s configure the Anthropic model in our <em>application.properties</em> file</strong>:</p>
<pre><code class="language-properties">spring.ai.anthropic.api-key=${ANTHROPIC_API_KEY}
spring.ai.anthropic.chat.options.model=claude-sonnet-5-5
spring.ai.anthropic.chat.options.max-tokens=1024</code></pre>
<p>Here, we load the Anthropic API key from the <em>ANTHROPIC_API_KEY</em> environment variable. Then, we specify the model to use and set the maximum number of tokens the model can generate in a response. In this case, we are using the <em>claude-sonnet-5-5</em> model.</p>
<h3 id="bd-1-metadataresponse-record" data-id="1-metadataresponse-record">3.1. <em>MetadataResponse</em> Record</h3>
<div class="bd-anchor" id="1-metadataresponse-record"></div>
<p>Moving on, let&#8217;s define a Java record to represent the response returned by our application:</p>
<pre><code class="language-java">public record MetadataResponse(
  String model,
  Long requestsLimit,
  Long requestsRemaining,
  Duration tokensReset,
  Long tokensLimit,
  Long tokensRemaining,
  Integer promptTokens,
  Integer completionTokens,
  String content) {
}
</code></pre>
<p>In the code above, <strong>we provided a structured representation of the data, </strong>such as model name, rate-limit information, token usage, and generated output to the client.</p>
<h3 id="bd-2-the-controller-class" data-id="2-the-controller-class">3.2. The Controller Class</h3>
<div class="bd-anchor" id="2-the-controller-class"></div>
<p>Next,<strong> let&#8217;s create a controller class and inject the <em>ChatClient</em> to initialize the <em>ChatClient</em></strong>:</p>
<pre><code class="language-java">@RestController
public class ChatResponseMetaController {
    private final ChatClient chatClient;
    public ChatResponseMetaController(ChatClient.Builder builder) {
        this.chatClient = builder.build();
    }
}</code></pre>
<p>With the <em>ChatClient</em> initialized, let&#8217;s add an endpoint that generates a short story. Also, the endpoint returns the associated model metadata, rate limits, and token usage:</p>
<pre><code class="language-java">@GetMapping("/story-gen")
public MetadataResponse chat(@RequestParam(defaultValue = "Tell a story in less than 100 words") String message) {
    ChatResponse chatResponse = chatClient.prompt()
      .user(message)
      .call()
      .chatResponse();
    ChatResponseMetadata metadata = chatResponse.getMetadata();
    RateLimit rateLimit = metadata.getRateLimit();
    Usage usage = metadata.getUsage();
    AssistantMessage output = chatResponse.getResult().getOutput();
    return new MetadataResponse(
      metadata.getModel(),
      rateLimit.getRequestsLimit(),
      rateLimit.getRequestsRemaining(),
      rateLimit.getTokensReset(),
      rateLimit.getTokensLimit(),
      rateLimit.getTokensRemaining(),
      usage.getPromptTokens(),
      usage.getCompletionTokens(),
      output.getText());
}</code></pre>
<p>Here, <strong>we use the<em> ChatClient</em> to send the user&#8217;s prompt to the configured Anthropic model and retrieve the resulting <em>ChatResponse</em></strong>. Then, we call the <em>getMetadata()</em> method to access the response metadata. From the metadata, <em>getRateLimit()</em> returns a <em>RateLimit</em> object containing the request and token limits reported by the provider.</p>
<p>We also call <em>getUsage()</em> to retrieve the token usage information and extract the generated text from the response. Finally, we populate the <em>MetadataResponse</em> record with these values, allowing our endpoint to return the generated story alongside the available rate limit and usage information.</p>
<h3 id="bd-3-get-request" data-id="3-get-request">3.3. GET Request</h3>
<div class="bd-anchor" id="3-get-request"></div>
<p>Moving on, <strong>let&#8217;s make a GET request to <em>/story-gen</em> to see the response</strong>:</p>
<pre><code class="language-json">{
    "model": "claude-sonnet-5-5",
    "requestsLimit": 10000,
    "requestsRemaining": 9999,
    "tokensReset": "PT0S",
    "tokensLimit": 12000000,
    "tokensRemaining": 12000000,
    "promptTokens": 20,
    "completionTokens": 200,
    "content":"..."
}</code></pre>
<p>In the above output, the request limit is 10000, with 9999 requests remaining after the request. The token-related fields show the reported token budget and the time until the token limit resets. The promptTokens and completionTokens fields indicate the tokens used to process the prompt and generate the response, respectively.</p>
<h2 id="bd-conclusion" data-id="conclusion">4. Conclusion</h2>
<div class="bd-anchor" id="conclusion"></div>
<p>In this article, we learned how to retrieve rate-limit metadata for Anthropic chat responses using the <em>ChatResponseMetadata</em> class. We accessed the <em>RateLimit</em> object through the <em>getRateLimit()</em> method and explored how to retrieve request limits, remaining requests, token limits, and token usage information.</p>
<p>The full source code for the examples is available <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/eugenp/tutorials/tree/master/spring-ai-modules/spring-ai-anthropic">over on GitHub</a>.</p><p>The post <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai-anthropic-rate-limit">Rate Limit Information from Anthropic API Response Headers Using ChatResponseMetadata in Spring AI</a> first appeared on <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com">Baeldung</a>.</p><Img align="left" border="0" height="1" width="1" alt="" style="border:0;float:left;margin:0;padding:0;width:1px!important;height:1px!important;" hspace="0" src="https://feeds.feedblitz.com/~/i/972994280/0/baeldung">
<div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972994280/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972994280/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f07%2fJava-Featured-13-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972994280/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972994280/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972994280/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/spring-ai-anthropic-rate-limit#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/spring-ai-anthropic-rate-limit/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</content:encoded>
					
					<wfw:commentRss>https://feeds.feedblitz.com/~/972994280/0/baeldung/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<webfeeds:featuredImage>https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-13-150x150.jpg</webfeeds:featuredImage></item>
<item>
<feedburner:origLink>https://www.baeldung.com/java-spring-ai-openai-sdk</feedburner:origLink>
		<title>Using the Official OpenAI Java SDK With Spring AI</title>
		<link>https://feeds.feedblitz.com/~/972994283/0/baeldung</link>
					<comments>https://feeds.feedblitz.com/~/972994283/0/baeldung#respond</comments>
		
		<dc:creator><![CDATA[Francesco Galgani]]></dc:creator>
		<pubDate>Sat, 14 Nov 2026 14:11:09 +0000</pubDate>
				<category><![CDATA[Spring AI]]></category>
		<category><![CDATA[OpenAI]]></category>
		<category><![CDATA[Spring AI ChatClient]]></category>
		<guid isPermaLink="false">https://www.baeldung.com/?p=205394</guid>
					<description><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="max-width:100% !important;height:auto !important;float: left; margin-right: 5px;" loading="lazy" /><p>Learn how to use Spring AI SDK bindings to integrate with OpenAI providers, using Spring abstractions while automatically configuring the underlying client.</p>
<p>The post <a rel="NOFOLLOW" href="https://feeds.feedblitz.com/~/972994283/0/baeldung">Using the Official OpenAI Java SDK With Spring AI</a> first appeared on <a rel="NOFOLLOW" href="https://www.baeldung.com">Baeldung</a>.</p><div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972994283/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972994283/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f07%2fJava-Featured-11-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972994283/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972994283/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972994283/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/java-spring-ai-openai-sdk#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/java-spring-ai-openai-sdk/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</description>
										<content:encoded><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="float: left; margin-right: 5px;" decoding="async" loading="lazy" srcset="https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-1024x536.jpg 1024w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-300x157.jpg 300w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-768x402.jpg 768w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-100x52.jpg 100w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11.jpg 1200w" sizes="auto, (max-width: 580px) 100vw, 580px" /><h2 id="bd-overview" data-id="overview">1. Overview</h2>
<div class="bd-anchor" id="overview"></div>
<p><strong>Spring AI 2.0 brings the official OpenAI Java SDK into its standard OpenAI integration.</strong> We can use it through Spring&#8217;s abstractions while letting Spring Boot configure the underlying client.</p>
<p>In this tutorial, we&#8217;ll summarize a support request with <em>ChatClient</em>, configure Gemini as an optional provider, and migrate from the former separate SDK module.</p>
<h2 id="bd-how-spring-ai-uses-the-openai-java-sdk" data-id="how-spring-ai-uses-the-openai-java-sdk">2. How Spring AI Uses the OpenAI Java SDK</h2>
<div class="bd-anchor" id="how-spring-ai-uses-the-openai-java-sdk"></div>
<p><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai">Spring AI</a> provides a common API for working with language models. For this integration, <em>ChatClient</em> delegates to <em>OpenAiChatModel</em>, which translates Spring messages and options into requests handled by the official SDK.</p>
<p><strong>Our application depends on Spring AI&#8217;s abstractions. The SDK handles the underlying API calls.</strong></p>
<p>Spring Boot auto-configuration supplies the model and a <em>ChatClient.Builder</em>. This differs from <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-openai-api-client">using the OpenAI Java client directly</a>, where we construct SDK requests ourselves.</p>
<p>Spring AI 2.0 removes the separate <em>spring-ai-openai-sdk</em> module. The <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://docs.spring.io/spring-ai/reference/api/chat/openai-chat.html">standard OpenAI integration</a> now uses the official SDK internally. In Spring AI 2.0.2, this integration uses the Chat Completions API and doesn&#8217;t support OpenAI&#8217;s Responses API.</p>
<h2 id="bd-setting-up-the-integration" data-id="setting-up-the-integration">3. Setting Up the Integration</h2>
<div class="bd-anchor" id="setting-up-the-integration"></div>
<p>Our example uses Java 21, Spring Boot 4.1.2, and Spring AI 2.0.2.</p>
<h3 id="bd-1-maven-dependencies" data-id="1-maven-dependencies">3.1. Maven Dependencies</h3>
<div class="bd-anchor" id="1-maven-dependencies"></div>
<p>In our Spring Boot project, let&#8217;s add the OpenAI starter:</p>
<pre><code class="language-xml">&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.ai&lt;/groupId&gt;
    &lt;artifactId&gt;spring-ai-starter-model-openai&lt;/artifactId&gt;
    &lt;version&gt;2.0.2&lt;/version&gt;
&lt;/dependency&gt;</code></pre>
<p>The latest <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://mvnrepository.com/artifact/org.springframework.ai/spring-ai-starter-model-openai"><em>spring-ai-starter-model-openai</em></a> version is available in the Maven Repository. Version 2.0.2 brings in <em>openai-java-core</em> 4.80.0 transitively, so we don&#8217;t need a separate SDK dependency.</p>
<h3 id="bd-2-credentials-and-model-configuration" data-id="2-credentials-and-model-configuration">3.2. Credentials and Model Configuration</h3>
<div class="bd-anchor" id="2-credentials-and-model-configuration"></div>
<p>We need an OpenAI API key and available API credits. Let&#8217;s supply the key through the <em>OPENAI_API_KEY</em> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-boot-properties-env-variables">environment variable</a>.</p>
<p>In <em>application.yml</em>, let&#8217;s configure the endpoint and limit the example&#8217;s response size:</p>
<pre><code class="language-yaml">spring:
  ai:
    openai:
      api-key: ${OPENAI_API_KEY}
      base-url: https://api.openai.com/v1
      timeout: 30s
      max-retries: 0
      chat:
        model: ${OPENAI_MODEL:gpt-6-luna}
        reasoning-effort: none
        max-completion-tokens: 256</code></pre>
<p>The full base URL includes <em>/v1</em>. The SDK appends <em>/chat/completions</em> when making our request.</p>
<p>For <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://developers.openai.com/api/docs/models/gpt-6-luna">GPT-6 Luna</a>, <em>reasoning-effort: none</em> disables reasoning, while <em>max-completion-tokens</em> caps generated tokens. We also set a request timeout and disable automatic retries to keep this small example&#8217;s API calls predictable.</p>
<h2 id="bd-calling-openai-compatible-models-through-chatclient" data-id="calling-openai-compatible-models-through-chatclient">4. Calling OpenAI-Compatible Models Through <em>ChatClient</em></h2>
<div class="bd-anchor" id="calling-openai-compatible-models-through-chatclient"></div>
<p>We want to send a synthetic support request and ask for a one-sentence summary containing the problem and requested action.</p>
<h3 id="bd-1-creating-the-summary-service" data-id="1-creating-the-summary-service">4.1. Creating the Summary Service</h3>
<div class="bd-anchor" id="1-creating-the-summary-service"></div>
<p>Let&#8217;s inject the auto-configured builder into our service:</p>
<pre><code class="language-java">@Service
public class SupportSummaryService {
    private final ChatClient chatClient;
    public SupportSummaryService(ChatClient.Builder builder) {
        this.chatClient = builder.defaultSystem(
          "Summarize the support request in one sentence. "
            + "Include the problem and the requested action. "
            + "Do not invent details.")
          .build();
    }
    public String summarize(String request) {
        return chatClient.prompt()
          .user(request)
          .call()
          .content();
    }
}</code></pre>
<p><em>defaultSystem()</em> establishes the summarization instruction. Each <em>summarize()</em> call adds the request as a user message, invokes the model synchronously, and returns its text.</p>
<p>The broader <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-ai-chatclient"><em>ChatClient</em> fluent API</a> also supports features such as streaming and structured output. Here, a plain string lets us focus on the SDK integration.</p>
<h3 id="bd-2-verifying-the-openai-call" data-id="2-verifying-the-openai-call">4.2. Verifying the OpenAI Call</h3>
<div class="bd-anchor" id="2-verifying-the-openai-call"></div>
<p>Our <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-boot-testing">Spring Boot test</a> injects <em>SupportSummaryService</em> and exercises it with a duplicate-charge request:</p>
<pre><code class="language-java">String summary = summaryService.summarize(
  "I was charged twice for my subscription. Please refund the duplicate charge.");
assertThat(summary).isNotBlank();
logger.info("OpenAI support summary: {}", summary);</code></pre>
<p>After setting our API key, let&#8217;s run the repository&#8217;s live test from the <em>spring-ai-modules/spring-ai-openai</em> directory:</p>
<pre><code class="language-bash">$ export OPENAI_API_KEY='our-openai-api-key'
mvn test -Dtest=OpenAiSupportSummaryLiveTest</code></pre>
<p>Both live tests use <em>@EnabledIfEnvironmentVariable</em>, so Maven reports a skipped test if the corresponding API key environment variable is missing or empty.</p>
<p>In our live run, OpenAI returned:</p>
<pre><code class="language-plaintext">I was charged twice for my subscription and request a refund for the duplicate charge.</code></pre>
<p><strong>The generated wording can vary, so we should check for nonblank output rather than an exact sentence.</strong></p>
<h3 id="bd-3-using-gemini-as-an-alternative" data-id="3-using-gemini-as-an-alternative">4.3. Using Gemini as an Alternative</h3>
<div class="bd-anchor" id="3-using-gemini-as-an-alternative"></div>
<p>For an alternative without paid OpenAI access, we can use Gemini&#8217;s <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://aistudio.google.com/docs/openai">OpenAI-compatible endpoint</a>. Gemini 3.5 Flash-Lite offers a <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://aistudio.google.com/docs/pricing">free tier</a>, subject to quotas and availability.</p>
<p>In <em>application-gemini.yml</em>, a separate <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-profiles">Spring profile</a> overrides the provider settings:</p>
<pre><code class="language-yaml">spring:
  ai:
    openai:
      api-key: ${GEMINI_API_KEY}
      base-url: https://generativelanguage.googleapis.com/v1beta/openai/
      timeout: 120s
      chat:
        model: ${GEMINI_MODEL:gemini-3.5-flash-lite}
        reasoning-effort: low
        max-completion-tokens: 1024</code></pre>
<p><strong>The service and SDK stay the same, but model-specific options still matter.</strong> Gemini 3 models can&#8217;t disable thinking, so we should replace <em>none</em> with <em>low</em> and allow more tokens.</p>
<p>We allow up to 120 seconds per request. The live test&#8217;s 180-second limit prevents JUnit from interrupting the request first.</p>
<p>The Gemini live test activates this profile itself, so we only need its key and test name:</p>
<pre><code class="language-bash">$ export GEMINI_API_KEY='our-gemini-api-key'
mvn test -Dtest=GeminiSupportSummaryLiveTest</code></pre>
<p>Our Gemini 3.5 Flash-Lite run returned:</p>
<pre><code class="language-plaintext">The user was charged twice for their subscription and is requesting a refund for the duplicate charge.</code></pre>
<h2 id="bd-migrating-from-the-separate-sdk-module" data-id="migrating-from-the-separate-sdk-module">5. Migrating From the Separate SDK Module</h2>
<div class="bd-anchor" id="migrating-from-the-separate-sdk-module"></div>
<p><strong>This migration applies to the former <em>spring-ai-openai-sdk</em> integration.</strong> The <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://docs.spring.io/spring-ai/reference/upgrade-notes.html">upgrade notes</a> describe its removal in Spring AI 2.0.</p>
<p>Applications already using the standard OpenAI module can keep their existing configuration properties, with <em>chat.options.*</em> retained as deprecated aliases. However, code that builds <em>OpenAiChatModel</em> manually needs updating.</p>
<p>In 2.0.2, <em>OpenAiApi</em> is gone. The model builder no longer provides <em>openAiApi()</em>, <em>defaultOptions()</em>, or <em>retryTemplate()</em>. It accepts the SDK&#8217;s <em>OpenAIClient</em> through <em>openAiClient()</em> and model settings through <em>options()</em>.</p>
<h3 id="bd-1-updating-the-starter-and-properties" data-id="1-updating-the-starter-and-properties">5.1. Updating the Starter and Properties</h3>
<div class="bd-anchor" id="1-updating-the-starter-and-properties"></div>
<p>When moving from Spring AI 1.1.x to 2.0.2, we also need a compatible Spring Boot 4 application. We should replace <em>spring-ai-starter-model-openai-sdk</em> with the starter shown in Section 3.1.</p>
<p>A configuration for the old SDK starter could contain:</p>
<pre><code class="language-properties">spring.ai.openai-sdk.api-key=${OPENAI_API_KEY}
spring.ai.openai-sdk.base-url=https://api.openai.com/v1
spring.ai.openai-sdk.chat.options.model=gpt-6-luna</code></pre>
<p>For Spring AI 2.0.2, the equivalent properties are:</p>
<pre><code class="language-properties">spring.ai.openai.api-key=${OPENAI_API_KEY}
spring.ai.openai.base-url=https://api.openai.com/v1
spring.ai.openai.chat.model=gpt-6-luna</code></pre>
<p>The prefix changes from <em>spring.ai.openai-sdk</em> to <em>spring.ai.openai</em>. Let&#8217;s use the flat <em>chat.model</em> property. The older <em>chat.options.model</em> spelling still works in 2.0.2, but it&#8217;s deprecated.</p>
<h3 id="bd-2-updating-model-classes-and-options" data-id="2-updating-model-classes-and-options">5.2. Updating Model Classes and Options</h3>
<div class="bd-anchor" id="2-updating-model-classes-and-options"></div>
<p>Code that referenced the separate module&#8217;s types needs these replacements:</p>
<ul>
<li><em>OpenAiSdkChatModel</em> becomes <em>OpenAiChatModel</em></li>
<li><em>OpenAiSdkChatOptions</em> becomes <em>OpenAiChatOptions</em></li>
</ul>
<p>The package changes from <em>org.springframework.ai.openaisdk</em> to <em>org.springframework.ai.openai</em>. This affects explicit model construction and programmatic options, even when the application&#8217;s prompt stays the same.</p>
<p>The former <em>OpenAiSdkChatModel</em> builder already used <em>openAiClient()</em> and <em>options()</em>, so these method names carry over when we rename the class.</p>
<p>Our service only uses <em>ChatClient.Builder</em> and <em>ChatClient</em>, so it doesn&#8217;t reference either SDK-specific class. <strong>The starter and configuration change while its summarization code remains unchanged.</strong></p>
<h2 id="bd-conclusion" data-id="conclusion">6. Conclusion</h2>
<div class="bd-anchor" id="conclusion"></div>
<p><strong>In this article, we used Spring AI&#8217;s standard OpenAI starter to summarize a support request through the official Java SDK.</strong> The same service worked with Gemini after changing the endpoint, credentials, and model options.</p>
<p>For applications using the removed SDK module, migration involves the starter, property prefix, and SDK-suffixed classes. Keeping application code centered on <em>ChatClient</em> limits the changes needed in the service layer.</p>
<p>The complete example is available <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/eugenp/tutorials/tree/master/spring-ai-modules/spring-ai-openai">over on GitHub</a>.</p><p>The post <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-spring-ai-openai-sdk">Using the Official OpenAI Java SDK With Spring AI</a> first appeared on <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com">Baeldung</a>.</p><Img align="left" border="0" height="1" width="1" alt="" style="border:0;float:left;margin:0;padding:0;width:1px!important;height:1px!important;" hspace="0" src="https://feeds.feedblitz.com/~/i/972994283/0/baeldung">
<div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972994283/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972994283/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f07%2fJava-Featured-11-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972994283/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972994283/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972994283/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/java-spring-ai-openai-sdk#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/java-spring-ai-openai-sdk/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</content:encoded>
					
					<wfw:commentRss>https://feeds.feedblitz.com/~/972994283/0/baeldung/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<webfeeds:featuredImage>https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-11-150x150.jpg</webfeeds:featuredImage></item>
<item>
<feedburner:origLink>https://www.baeldung.com/java-weekly-671</feedburner:origLink>
		<title>Java Weekly, Issue 671</title>
		<link>https://feeds.feedblitz.com/~/972991964/0/baeldung</link>
					<comments>https://feeds.feedblitz.com/~/972991964/0/baeldung#respond</comments>
		
		<dc:creator><![CDATA[baeldung]]></dc:creator>
		<pubDate>Sat, 14 Nov 2026 12:51:19 +0000</pubDate>
				<category><![CDATA[Weekly Review]]></category>
		<category><![CDATA[no-ads]]></category>
		<category><![CDATA[no-after-post]]></category>
		<category><![CDATA[no-before-post]]></category>
		<category><![CDATA[no-optins]]></category>
		<guid isPermaLink="false">https://www.baeldung.com/?p=205440</guid>
					<description><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="max-width:100% !important;height:auto !important;float: left; margin-right: 5px;" loading="lazy" /><p>Some simple Maven wins and an interesting piece on testing in the agentic era.</p>
<p>The post <a rel="NOFOLLOW" href="https://feeds.feedblitz.com/~/972991964/0/baeldung">Java Weekly, Issue 671</a> first appeared on <a rel="NOFOLLOW" href="https://www.baeldung.com">Baeldung</a>.</p><div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972991964/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972991964/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2016%2f10%2fsocial-Weekly-Reviews-4.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972991964/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972991964/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972991964/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/java-weekly-671#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/java-weekly-671/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</description>
										<content:encoded><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="float: left; margin-right: 5px;" decoding="async" loading="lazy" srcset="https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4.jpg 952w, https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4-300x157.jpg 300w, https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4-768x402.jpg 768w" sizes="auto, (max-width: 580px) 100vw, 580px" /><h2 style="text-align: left" id="bd-spring-and-java" data-id="spring-and-java">1.<strong> Spring and Java</strong></h2>
<div class="bd-anchor" id="spring-and-java"></div>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/beyond-mvn-install-maven-practices/">&gt;&gt; Beyond mvn install: Maven Practices That Pay Off</a></strong> [<span style="color: #993300">foojay.io</span>]</p>
<p>A tour of the <strong>cheap wins hiding in a <code>pom.xml</code></strong>, drawn from real open-source projects: fail fast with the Enforcer, pin every plugin version through curated parent POMs, let profiles switch themselves on, and get an SBOM almost for free. Good stuff.</p>
<h4><strong>Also worth reading:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://inside.java/2026/11/11/withdraw-primitive-patterns-preview/" target="_blank" rel="noopener"><strong>Withdrawing the Primitive Patterns Preview Feature</strong></a> [<span style="color: #800000">inside.java</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/testcontainers-integration-testing-running-your-real-war-in-docker/" target="_blank" rel="noopener"><strong>Testcontainers Integration Testing: Running Your Real WAR in Docker</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/java-ai-agent-mysql-rest-service-cancellations/" target="_blank" rel="noopener"><strong>Letting a Java AI Agent Request Cancellations with MySQL REST Service</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/how-i-got-a-thread-dump-from-a-timed-out-github-actions-test/" target="_blank" rel="noopener"><strong>How I got a thread dump from a timed-out GitHub Actions test</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://inside.java/2026/11/10/g1gc-tutorial/" target="_blank" rel="noopener"><strong>Tutorial: The G1 Garbage Collector</strong></a> [<span style="color: #800000">inside.java</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://dev.java/learn/jvm/tool/garbage-collection/g1gc-overview/" target="_blank" rel="noopener"><strong>The G1 Garbage Collector</strong></a> [<span style="color: #800000">dev.java</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://quarkus.io/blog/ai-root-cause-analysis/" target="_blank" rel="noopener"><strong>AI Root Cause Analysis: LLM-Powered Root-Cause Analysis for Distributed Systems</strong></a> [<span style="color: #800000">quarkus.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://quarkus.io/blog/quarkus-sonify/" target="_blank" rel="noopener"><strong>Hear your application with Quarkus Sonify</strong></a> [<span style="color: #800000">quarkus.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/10/spring-pulsar-new-home-asf/" target="_blank" rel="noopener"><strong>Announcing a New Home for Spring for Apache Pulsar</strong></a> [<span style="color: #800000">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/enforce-java-module-boundaries-with-modulith-rules/" target="_blank" rel="noopener"><strong>Checking Module Boundaries in a Java Monolith</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://inside.java/2026/11/09/inside-java-ticker-value-class/" target="_blank" rel="noopener"><strong>A Valhalla Ticker in One int</strong></a> [<span style="color: #800000">inside.java</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/the-tests-passed-the-feature-had-never-worked/" target="_blank" rel="noopener"><strong>The tests passed. The feature had never worked.</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/jip/" target="_blank" rel="noopener"><strong>jip: Clone a Java Project. Run It. Done.</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/spring-ai-langchain4j-three-stacks-one-test/" target="_blank" rel="noopener"><strong>Spring AI or LangChain4j? One App, Three Stacks, One Test</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/dukehoff-decide-calibrated-decisions/" target="_blank" rel="noopener"><strong>dukehoff-decide: Typed, Calibrated Decisions from Small Language Models</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
</ul>
<h4><strong>Webinars and presentations:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.infoq.com/podcasts/distributed-llm-inference-kubernetes/" target="_blank" rel="noopener"><strong>Distributed LLM Inference on Kubernetes with llm-d, Wasm, &amp; TornadoVM</strong></a> [<span style="color: #800000">infoq.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/09/spring-office-hours-podcast-S5E29/" target="_blank" rel="noopener"><strong>Spring Office Hours Podcast: S5E29 &#8211; Spring AI ACP Harness Client</strong></a> [<span style="color: #800000">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://quarkus.io/blog/quarkus-insights-267-sandboxing-agents-with-quarkus-for-quarkus/" target="_blank" rel="noopener"><strong>Quarkus Insights #267: Sandboxing agents with Quarkus, for Quarkus</strong></a> [<span style="color: #800000">quarkus.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://inside.java/2026/11/08/devoxxbelgium-java-next-programming-models/" target="_blank" rel="noopener"><strong>Java and the Next Generation of Programming Models</strong></a> [<span style="color: #800000">inside.java</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/05/a-bootiful-podcast-cornelia-davis/" target="_blank" rel="noopener"><strong>A Bootiful Podcast: Temporal.io&#8217;s Cornelia Davis</strong></a> [<span style="color: #800000">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://inside.java/2026/11/05/podcast-074/" target="_blank" rel="noopener"><strong>Episode 74 “Ask the Architects at Devoxx” [AtA]</strong></a> [<span style="color: #800000">inside.java</span>]</li>
</ul>
<h4><strong>Time to upgrade:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/09/spring-ai-2-1-0-RC2-available-now/" target="_blank" rel="noopener"><strong>Spring AI 2.1.0-RC2 Available Now</strong></a> [<span style="color: #800000">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/06/spring-boot-4-2-0-RC2-available-now/" target="_blank" rel="noopener"><strong>Spring Boot 4.2.0-RC2 available now</strong></a> [<span style="color: #800000">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/11/05/spring-cloud-2026-0-0-RC2-has-been-released/" target="_blank" rel="noopener"><strong>Spring Cloud 2026.0.0-RC2 (aka Paddington) Has Been Released</strong></a> [<span style="color: #800000">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.jetbrains.com/idea/2026/11/whats-new-in-intellij-idea-2026-3/" target="_blank" rel="noopener"><strong>What&#8217;s New in IntelliJ IDEA 2026.3</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.jetbrains.com/idea/2026/11/whats-fixed-in-intellij-idea-2026-3/" target="_blank" rel="noopener"><strong>What’s fixed in IntelliJ IDEA 2026.3</strong></a> [<span style="color: #800000">jetbrains.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/rulebox-20-business-rules-without-the-business-logic-mess/" target="_blank" rel="noopener"><strong>RuleBox 2.0: Business Rules Without the Business Logic Mess</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> Quarkus <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://quarkus.io/blog/quarkus-3-40-1-2-released/" target="_blank" rel="noopener"><strong>3.40.1.2</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://quarkus.io/blog/quarkus-3-33-4-2-released/" target="_blank" rel="noopener"><strong>3.33.4.2</strong></a> [<span style="color: #800000">quarkus.io</span>]</li>
<li><strong>&gt;&gt;</strong> Jetty <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/jetty/jetty.project/releases/tag/jetty-12.1.15" target="_blank" rel="noopener"><strong>12.1.15</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/jetty/jetty.project/releases/tag/jetty-12.0.41" target="_blank" rel="noopener"><strong>12.0.41</strong></a> [<span style="color: #800000">github.com/jetty</span>]</li>
<li><strong>&gt;&gt;</strong> Elasticsearch <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/elastic/elasticsearch/releases/tag/v8.19.25" target="_blank" rel="noopener"><strong>8.19.25</strong></a> [<span style="color: #800000">github.com/elastic</span>]</li>
<li><strong>&gt;&gt;</strong> Micronaut Core <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/micronaut-projects/micronaut-core/releases/tag/v5.2.23" target="_blank" rel="noopener"><strong>5.2.23</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/micronaut-projects/micronaut-core/releases/tag/v4.10.37" target="_blank" rel="noopener"><strong>4.10.37</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/micronaut-projects/micronaut-core/releases/tag/v3.10.19" target="_blank" rel="noopener"><strong>3.10.19</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/micronaut-projects/micronaut-core/releases/tag/v3.10.18" target="_blank" rel="noopener"><strong>3.10.18</strong></a> [<span style="color: #800000">github.com/micronaut-projects</span>]</li>
<li><strong>&gt;&gt;</strong> Payara <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/payara/Payara/releases/tag/payara-server-7.2026.11" target="_blank" rel="noopener"><strong>7.2026.11</strong></a> [<span style="color: #800000">github.com/payara</span>]</li>
</ul>
<h2 style="text-align: left" id="bd-technical-amp-musings" data-id="technical-amp-musings">2.<strong> Technical &amp; Musings</strong></h2>
<div class="bd-anchor" id="technical-amp-musings"></div>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://martinfowler.com/articles/tests-as-data.html">&gt;&gt; Tests as data</a></strong> [<span style="color: #993300">martinfowler.com</span>]</p>
<p>A very current problem &#8211; AI agents can write both the production code and the tests, what still protects us from functional errors? An interesting weekend read.</p>
<h4><strong>Also worth reading:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.allthingsdistributed.com/2026/11/aws-emulator-and-the-engineers-job-when-agents-write-the-code.html" target="_blank" rel="noopener"><strong>AWS Emulator and the engineer&#8217;s job when agents write the code</strong></a> [<span style="color: #800000">allthingsdistributed.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/bcn-where-does-experience-come-from/" target="_blank" rel="noopener"><strong>Where Does The Experience Come From?</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/duckdb-quack-server-hello-world/" target="_blank" rel="noopener"><strong>Setting Up a DuckDB Quack Server: A Hello World</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://martinfowler.com/articles/durable-execution-agents.html" target="_blank" rel="noopener"><strong>Long-horizon agents and durable execution</strong></a> [<span style="color: #800000">martinfowler.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://netflixtechblog.com/fact-checking-at-scale-building-a-more-accurate-and-efficient-synopsis-factuality-system-d7d85859d808" target="_blank" rel="noopener"><strong>Fact-Checking at Scale: Building a More Accurate and Efficient Synopsis Factuality System</strong></a> [<span style="color: #800000">netflixtechblog.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.frankel.ch/skills-across-coding-assistants/" target="_blank" rel="noopener"><strong>Skills across coding assistants</strong></a> [<span style="color: #800000">frankel.ch</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.codepipes.com/llms/ai-agents-handheld.html" target="_blank" rel="noopener"><strong>Controlling your AI agents from a game handheld</strong></a> [<span style="color: #800000">codepipes.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.infoq.com/articles/identity-as-architecture/" target="_blank" rel="noopener"><strong>Identity as an Architectural Concern: Enterprise IAM Beyond Authentication</strong></a> [<span style="color: #800000">infoq.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://martinfowler.com/articles/data-product-platform-nav.html" target="_blank" rel="noopener"><strong>The Data Product Platform Navigator</strong></a> [<span style="color: #800000">martinfowler.com</span>]</li>
</ul>
<h2 style="text-align: left" id="bd-pick-of-the-week" data-id="pick-of-the-week">3.<strong> Pick of the Week</strong></h2>
<div class="bd-anchor" id="pick-of-the-week"></div>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://kk.org/thetechnium/1000-true-fans/">&gt;&gt; 1,000 True Fans</a></strong> [<span style="color: #993300">kk.org</span>]
<br>
</p><p>The post <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-weekly-671">Java Weekly, Issue 671</a> first appeared on <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com">Baeldung</a>.</p><Img align="left" border="0" height="1" width="1" alt="" style="border:0;float:left;margin:0;padding:0;width:1px!important;height:1px!important;" hspace="0" src="https://feeds.feedblitz.com/~/i/972991964/0/baeldung">
<div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972991964/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972991964/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2016%2f10%2fsocial-Weekly-Reviews-4.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972991964/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972991964/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972991964/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/java-weekly-671#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/java-weekly-671/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</content:encoded>
					
					<wfw:commentRss>https://feeds.feedblitz.com/~/972991964/0/baeldung/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<webfeeds:featuredImage>https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4-150x150.jpg</webfeeds:featuredImage></item>
<item>
<feedburner:origLink>https://www.baeldung.com/spring-authorization-server-openid-connect-userinfo-response-customize</feedburner:origLink>
		<title>Customize the OpenID Connect 1.0 UserInfo Response in Spring Authorization Server</title>
		<link>https://feeds.feedblitz.com/~/972819959/0/baeldung</link>
					<comments>https://feeds.feedblitz.com/~/972819959/0/baeldung#respond</comments>
		
		<dc:creator><![CDATA[Philippe Sevestre]]></dc:creator>
		<pubDate>Wed, 11 Nov 2026 13:16:37 +0000</pubDate>
				<category><![CDATA[Spring MVC]]></category>
		<category><![CDATA[Spring Security]]></category>
		<category><![CDATA[Authorization]]></category>
		<guid isPermaLink="false">https://www.baeldung.com/?p=205342</guid>
					<description><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/11/Security-Featured-Image-06-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="max-width:100% !important;height:auto !important;float: left; margin-right: 5px;" loading="lazy" /><p>Learn how to customize the Spring Authorization Server UserInfo endpoint handling.</p>
<p>The post <a rel="NOFOLLOW" href="https://feeds.feedblitz.com/~/972819959/0/baeldung">Customize the OpenID Connect 1.0 UserInfo Response in Spring Authorization Server</a> first appeared on <a rel="NOFOLLOW" href="https://www.baeldung.com">Baeldung</a>.</p><div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972819959/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972819959/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f11%2fSecurity-Featured-Image-06-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972819959/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972819959/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972819959/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/spring-authorization-server-openid-connect-userinfo-response-customize#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/spring-authorization-server-openid-connect-userinfo-response-customize/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</description>
										<content:encoded><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/11/Security-Featured-Image-06-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="float: left; margin-right: 5px;" decoding="async" loading="lazy" srcset="https://www.baeldung.com/wp-content/uploads/2024/11/Security-Featured-Image-06-1024x536.jpg 1024w, https://www.baeldung.com/wp-content/uploads/2024/11/Security-Featured-Image-06-300x157.jpg 300w, https://www.baeldung.com/wp-content/uploads/2024/11/Security-Featured-Image-06-768x402.jpg 768w, https://www.baeldung.com/wp-content/uploads/2024/11/Security-Featured-Image-06-100x52.jpg 100w, https://www.baeldung.com/wp-content/uploads/2024/11/Security-Featured-Image-06-600x314.jpg 600w, https://www.baeldung.com/wp-content/uploads/2024/11/Security-Featured-Image-06.jpg 1200w" sizes="auto, (max-width: 580px) 100vw, 580px" /><h2 id="bd-introduction" data-id="introduction">1. Introduction</h2>
<div class="bd-anchor" id="introduction"></div>
<p>For most applications, user authentication is simply the first step to go through before providing any real services. In general, we need to associate the user identification with domain-specific information necessary to implement those services.</p>
<p><strong>In this tutorial, we&#8217;ll show how to customize the<a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://docs.spring.io/spring-security/reference/servlet/oauth2/authorization-server/protocol-endpoints.html#oauth2AuthorizationServer-oidc-user-info-endpoint"> Spring Authorization Server UserInfo endpoint</a> handling, so client applications can get access to this information in a standard way</strong>.</p>
<h2 id="bd-whats-the-openid-connect-10-userinfo-endpoint" data-id="whats-the-openid-connect-10-userinfo-endpoint">2. What&#8217;s the OpenID Connect 1.0 UserInfo Endpoint?</h2>
<div class="bd-anchor" id="whats-the-openid-connect-10-userinfo-endpoint"></div>
<p>The OpenID Connect specification adds an identity layer on top of the OAuth 2.0 standard, which allows identity providers, or IdP for short, to provide clients with identity information in two ways:</p>
<ul>
<li><em>id_token</em>: a JWT, handed to a client as part of the authentication flow, containing a set of user attributes – also known as claims – in the token&#8217;s payload</li>
<li><em>UserInfo</em> endpoint: an optional endpoint, though largely supported by current implementations, that returns user claims either as a JSON object or a signed and/or encrypted JWT</li>
</ul>
<p>While similar in content, there are some technical and semantic differences between them:</p>
<table class="table-styled" style="border-collapse: collapse;width: 89.2588%">
<thead>
<tr>
<th style="width: 13.6725%"></th>
<th style="width: 34.9665%"><em>id_token</em></th>
<th style="width: 40.6197%"><em>UserInfo</em> endpoint</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 13.6725%">Delivery</td>
<td style="width: 34.9665%">authorization callback or token endpoint</td>
<td style="width: 40.6197%">GET (recommended) or POST request to the IdP using the <em>access_token</em> received as part of the authorization flow</td>
</tr>
<tr>
<td style="width: 13.6725%">Required claims</td>
<td style="width: 34.9665%"><em>iss</em> (issuer), <em>aud </em>(audience), <em>sub</em> (subject), <em>exp</em> (expiration time), <em>iat</em> (issuance time)</td>
<td style="width: 40.6197%"><em>sub, </em>but <em>iss</em> and <em>aud</em> are also mandatory when the response is a signed JWT</td>
</tr>
<tr>
<td style="width: 13.6725%">Security attributes</td>
<td style="width: 34.9665%">JWT Signature with optional encryption; optional login details claims(<em>acr,</em> <em>amr, </em>etc)</td>
<td style="width: 40.6197%">Signature and encryption are optional</td>
</tr>
<tr>
<td style="width: 13.6725%">Primary use case</td>
<td style="width: 34.9665%">authentication-related and minimal user identity attributes</td>
<td style="width: 40.6197%">full profile information</td>
</tr>
</tbody>
</table>
<p>Besides the required claims, the specification also <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims">defines a set of standard claims</a> which, in many cases, are enough to populate an application account with user details. <strong>The key difference is when we use each method</strong>.</p>
<p>For the <em>id_token</em>, the attributes represent a snapshot taken at authentication time, and once issued, the only reliable and portable way to get an updated version is to go through a full authorization flow. The exception to this rule is when the IdP supports returning the <em>id_token </em>when returning a new <em>access_token </em>from <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://openid.net/specs/openid-connect-core-1_0-errata2.html#RefreshTokens">a <em>refresh_token </em>request</a>.</p>
<p>In contrast, a client application can use the <em>UserInfo</em> endpoint whenever it wants to get the most recent version of the data, making it a go-to choice when implementing &#8220;My Profile&#8221; pages or similar functionality. Another relevant scenario is when the client application calls a backend resource server that requires some user profile attribute not already present in the <em>access_token</em>. In this case, the backend uses the received token to query the <em>UserInfo</em> endpoint, possibly caching it to avoid extra delays in subsequent calls.</p>
<h2 id="bd-spring-authorization-server-default-implementation" data-id="spring-authorization-server-default-implementation">3. Spring Authorization Server Default Implementation</h2>
<div class="bd-anchor" id="spring-authorization-server-default-implementation"></div>
<p>We&#8217;ve already covered the basics of the Spring Authorization Server (SAS for short) in previous tutorials, so we won&#8217;t go into much detail here.<strong> As a quick reminder, since Spring Security 7 and Spring Boot 4, SAS is no longer a standalone project but a standard module within those frameworks.</strong></p>
<p>Here are the required Maven dependencies for our WebMVC-based project:</p>
<pre><code class="language-xml">&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-starter-security-oauth2-authorization-server&lt;/artifactId&gt;
    &lt;version&gt;4.0.5&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-starter-security-oauth2-authorization-server-test&lt;/artifactId&gt;
    &lt;version&gt;4.0.5&lt;/version&gt;
    &lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
</code></pre>
<p>The latest versions of these dependencies are available on Maven Central:</p>
<p>• <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security-oauth2-authorization-server">spring-boot-starter-security-oauth2-authorization-server</a>
<br>
• <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security-oauth2-authorization-server-test">spring-boot-starter-security-oauth2-authorization-server-test</a></p>
<p>Let&#8217;s start by creating a minimal <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/projects/spring-security">Spring Security</a> configuration to see what we get &#8220;out-of-the-box&#8221;:</p>
<pre><code class="language-java">@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http) {
    return http.oauth2AuthorizationServer(sas -&gt; {
        http
          .securityMatcher(sas.getEndpointsMatcher())
          .authorizeHttpRequests(authorize -&gt; authorize.anyRequest().authenticated())
          .exceptionHandling(exceptions -&gt;
            exceptions.defaultAuthenticationEntryPointFor(
              new LoginUrlAuthenticationEntryPoint("/login"),
              createRequestMatcher()));
        sas.oidc(withDefaults());
    }).build();
}
@Bean
@Order(SecurityFilterProperties.BASIC_AUTH_ORDER)
SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) {
    http
      .authorizeHttpRequests(authorize -&gt; authorize.anyRequest().authenticated())
      .formLogin(withDefaults());
    return http.build();
}
</code></pre>
<p>We also need a test client and user, which we&#8217;ll provide using this YAML configuration:</p>
<pre><code class="language-yaml">spring:
  security:
    user:
      name: user
      password: "{noop}password"
    oauth2:
      authorizationserver:
        client:
          client1:
            require-proof-key: false
            require-authorization-consent: false
            registration:
              client-name: "Client 1 - Issuer 1"
              client-id: client1
              client-secret: "{noop}secret1"
              client-authentication-methods:
                - client_secret_basic
              redirect-uris:
                - http://localhost:9090/login/oauth2/code/issuer1client1
              authorization-grant-types:
                - authorization_code
                - refresh_token
              scopes:
                - openid
                - email
                - profile
                - account</code></pre>
<p>The test client, <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/eugenp/tutorials/tree/master/spring-security-modules/spring-security-modules/spring-security-auth-server/src/test/java/com/baeldung/auth/server/customclaims/DefaultUserinfoAuthServerUnitTest.java">available online</a>, goes through the following steps to get the <em>UserInfo</em> response:</p>
<ul>
<li>Fetch and parse the OIDC discovery document to find the required endpoints</li>
<li>Start an authentication flow which includes the custom <em>account</em>  scope and submit the login form using the test credentials</li>
<li>Use the authorization code to get the <em>access</em> and <em>id</em> tokens</li>
<li>Use the access token to retrieve the userinfo data</li>
</ul>
<p><strong>Running the test shows that the only available claim is <em>sub</em>, which contains the username used to log into the application</strong>. This is expected, as this is the only information provided by the underlying authentication mechanism.</p>
<h2 id="bd-userinfo-service-implementation" data-id="userinfo-service-implementation">4. <em>UserInfo</em> Service Implementation</h2>
<div class="bd-anchor" id="userinfo-service-implementation"></div>
<p>Before we can add any claim, we need to define a source for it. <strong>The idea is to decouple the information retrieval aspect from the <em>UserInfo</em> response customization</strong>. This approach has the added benefit that it makes it easy to reuse this service to customize the <em>id_token</em> generation.</p>
<p>Our service contains a single method that, given a username, returns a record with the attributes we&#8217;ll add:</p>
<pre><code class="language-java">@Service
public class UserInfoService {
    static final Map&lt;String, UserInfo&gt; users = Map.of(
        "user", new UserInfo(
        "user",
        "Alice Smith",
        "Alice",
        "Smith",
        "alice.smith@example.com",
        true,
        Locale.forLanguageTag("en-US"),
        "female",
        LocalDate.of(1990, 1, 1),
        ZoneId.of("America/New_York"),
        UUID.randomUUID(),
        Instant.now(),
        Instant.now(),
        Instant.now().plus(60, java.time.temporal.ChronoUnit.DAYS)
        )
    );
    public Optional&lt;UserInfo&gt; getUserInfoByUsername(String username) {
        return Optional.ofNullable(users.get(username));
    }
    public record UserInfo(
        String username,
        String name,
        String givenName,
        String familyName,
        String email,
        boolean emailVerified,
        Locale locale,
        String gender,
        LocalDate birthdate,
        ZoneId zoneId,
        UUID accountId,
        Instant createdAt,
        Instant updatedAt,
        Instant accountExpiresAt
    ) {}
}
</code></pre>
<p>Here, the implementation just looks up the username in a static map and returns the associated information record. <strong>A real-world implementation would use some repository to get this information, like a database, LDAP, or a REST service.</strong></p>
<p>We&#8217;ve also added the <em>@Service</em> annotation to the class, which allows Spring to automatically add it to the application context. In turn, this allows us to inject the service where needed, as we&#8217;ll see in the next section.</p>
<h2 id="bd-userinfo-mapping" data-id="userinfo-mapping">5. <em>UserInfo</em> Mapping</h2>
<div class="bd-anchor" id="userinfo-mapping"></div>
<p><strong>To use <em>UserInfoService</em> with SAS, we must implement a <em>Function</em> that maps an <em>OidcUserInfoAuthenticationContext</em> instance to an <em>OidcUserInfo</em> object</strong>. The SAS-provided <em>OidcUserInfoAuthenticationContext</em> contains the following fields:</p>
<ul>
<li><em>authentication</em>: a valid <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://docs.spring.io/spring-security/reference/servlet/authentication/architecture.html#servlet-authentication-authentication"><em>Authentication</em></a> associated with the request. We can use <em>getName()</em> to get the username associated with the request</li>
<li><em>authorization</em>: The OAuth 2.0 authorization used to generate the access token sent to the client.</li>
<li><em>accessToken</em>: The received access token, which can be useful if we want to access downstream protected resources</li>
</ul>
<p><strong>The <em>authorization</em> contains the client&#8217;s authorized scopes, with which we filter the information returned from <em>UserInfoService</em> while building the final <em>OidcUserInfo </em>instance.</strong></p>
<p>The <em>UserInfoMapper</em> class implements this:</p>
<pre><code class="language-java">public class UserInfoMapper implements Function&lt;OidcUserInfoAuthenticationContext, OidcUserInfo&gt; {
    private final UserInfoService userInfoService;
    // ... constructor omitted
    @Override
    public OidcUserInfo apply(OidcUserInfoAuthenticationContext context) {
        var auth = context.getAuthentication();
        var subject = auth.getName();
        var scopes = context.getAuthorization().getAuthorizedScopes();
        var userInfo = userInfoService.getUserInfoByUsername(subject);
        if ( userInfo.isEmpty() || scopes.isEmpty() || (scopes.size() == 1 &amp;&amp; scopes.contains("openid")) ) {
            return OidcUserInfo.builder()
              .subject(subject)
              .build();
        }
        var user = userInfo.get();
        var b = OidcUserInfo.builder().subject(subject);
        if ( scopes.contains("email") ) {
            b.email(user.email())
              .emailVerified(user.emailVerified());
        }
        if( scopes.contains("profile") ) {
            b.name(user.name())
              .givenName(user.givenName())
              .familyName(user.familyName())
              .locale(user.locale().toLanguageTag())
              .gender(user.gender())
              .birthdate(user.birthdate().toString())
              .zoneinfo(user.zoneId().toString())
              .preferredUsername(user.username())
              .claim(StandardClaimNames.UPDATED_AT, user.updatedAt().getEpochSecond());
        }
        if ( scopes.contains("account") ) {
            b.claim("account_id", user.accountId().toString())
              .claim("created_at", user.createdAt().getEpochSecond())
              .claim("account_expires_at", user.accountExpiresAt().getEpochSecond());
        }
        return b.build();
    }
}
</code></pre>
<p>Notice that, for the <em>updated_at </em>claim, we&#8217;re not using the builder&#8217;s <em>updatedAt</em> method. The reason is that Spring, at least in its current version, outputs this claim as a string instead of a JSON number. As a workaround, we use the generic <em>claim()</em> method, which accept any object as the claim&#8217;s value.</p>
<p>Here, we have a small fixed list of scopes, which allows us to use a simple set of &#8220;if&#8221; statements for building the <em>OidcUserInfo</em> instance. For a larger set of scopes, we need a more structured approach. For instance, we could use a map from scopes to &#8220;claim populators&#8221; responsible for mapping attributes from the user&#8217;s value object to <em>OidcUserInfo</em>.</p>
<h2 id="bd-registering-the-userinfo-mapping" data-id="registering-the-userinfo-mapping">6. Registering the <em>UserInfo</em> Mapping</h2>
<div class="bd-anchor" id="registering-the-userinfo-mapping"></div>
<p>The final step we need to take is to configure SAS with our custom mapper. This is done in the <em>oidc</em> configurer accessible in the authorization server&#8217;s DSL:</p>
<pre><code class="language-java">@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http, UserInfoMapper userInfoMapper) {
    return http.oauth2AuthorizationServer(sas -&gt; {
      http
        .securityMatcher(sas.getEndpointsMatcher())
        .authorizeHttpRequests(authorize -&gt; authorize.anyRequest().authenticated())
        .exceptionHandling(exceptions -&gt;
          exceptions.defaultAuthenticationEntryPointFor(
            new LoginUrlAuthenticationEntryPoint("/login"),
            createRequestMatcher()));
      if (enableCustomUserInfo) {
        sas.oidc(oidc -&gt; oidc
          .userInfoEndpoint(userInfo -&gt; userInfo
            .userInfoMapper(userInfoMapper)));
      }
      else {
        sas.oidc(withDefaults());
      }
    }).build();
}
</code></pre>
<p>For illustration/testing purposes only, we&#8217;ve conditionally configured our custom mapper using a feature flag (<em>enableCustomUserInfo</em>). This allows us to quickly enable/disable this functionality through the <em>customuserinfo.enabled</em> property and compare the results.</p>
<h2 id="bd-testing-the-complete-flow" data-id="testing-the-complete-flow">7. Testing the Complete Flow</h2>
<div class="bd-anchor" id="testing-the-complete-flow"></div>
<p>We complete the coding for this tutorial with a unit test that goes through the authentication flow and uses the resulting access token to query the <em>UserInfo</em> endpoint.</p>
<p>The full code, <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/eugenp/tutorials/tree/master/spring-security-modules/spring-security-modules/spring-security-auth-server/src/test/java/com/baeldung/auth/server/customclaims/CustomClaimsAuthServerUnitTest.java">available online</a>, is mostly identical to what we&#8217;ve presented here, with the following differences:</p>
<ul>
<li>We ensure that the <em>customuserinfo.enabled</em> property is set to <em>true</em></li>
<li>Extra assert statements at the end to check the presence of the custom claims</li>
</ul>
<p>To get a better understanding of SAS&#8217;s inner workings, a good approach is to run the unit test from an IDE and set breakpoints at key points. One of them is the <em>UserInfoService</em> implementation. Once the test reaches the <em>getUserInfoByUsername()</em> method, we can walk back the call stack up to the <em>OidcUserInfoEndpointFilter</em>, where we&#8217;ll be able to see how the authentication/authorization components collaborate.</p>
<h2 id="bd-other-available-customizations" data-id="other-available-customizations">8. Other Available Customizations</h2>
<div class="bd-anchor" id="other-available-customizations"></div>
<p>SAS&#8217;s customization possibilities do not stop at adding extra claims, though this is the most common scenario.</p>
<p>The <em>oidc</em> DSL, as it is the case with other endpoints, allows developers to take full control of the endpoint&#8217;s processing. Although not covered in this tutorial, let&#8217;s briefly describe them:</p>
<ul>
<li><em>userInfoRequestConverter</em>: adds a custom request converter, which converts an HttpServletRequest to an Authentication</li>
<li><em>userInfoRequestConverters</em>: allows us to add, remove, or modify the list of authentication converters</li>
<li><em>authenticationProvider</em>: adds a custom authentication provider to the list of available providers used to authenticate a request</li>
<li><em>authenticationProviders</em>: allows us to add, remove, or modify authentication providers</li>
<li><em>userInfoResponseHandler</em>: replace the logic used to generate the final response sent to clients</li>
<li><em>errorResponseHandler</em>: replace the logic used to generate the response sent to clients in case of error.</li>
</ul>
<p>Together, those methods allow us to handle any custom requirements related to the request processing. For example, if we wanted to encrypt the response or use a custom authentication method, we&#8217;d use the appropriate methods to replace the standard processing with our custom one.</p>
<h2 id="bd-conclusion" data-id="conclusion">9. Conclusion</h2>
<div class="bd-anchor" id="conclusion"></div>
<p>In this tutorial, we&#8217;ve shown how to customize the Spring Authorization Server&#8217;s <em>UserInfo</em> endpoint, so the response includes extra claims retrieved from a developer-supplied service.</p>
<div>As always, the full source code is available <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/eugenp/tutorials/tree/master/spring-security-modules/spring-security-auth-server">over on GitHub</a>.</div><p>The post <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/spring-authorization-server-openid-connect-userinfo-response-customize">Customize the OpenID Connect 1.0 UserInfo Response in Spring Authorization Server</a> first appeared on <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com">Baeldung</a>.</p><Img align="left" border="0" height="1" width="1" alt="" style="border:0;float:left;margin:0;padding:0;width:1px!important;height:1px!important;" hspace="0" src="https://feeds.feedblitz.com/~/i/972819959/0/baeldung">
<div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972819959/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972819959/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f11%2fSecurity-Featured-Image-06-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972819959/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972819959/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972819959/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/spring-authorization-server-openid-connect-userinfo-response-customize#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/spring-authorization-server-openid-connect-userinfo-response-customize/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</content:encoded>
					
					<wfw:commentRss>https://feeds.feedblitz.com/~/972819959/0/baeldung/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<webfeeds:featuredImage>https://www.baeldung.com/wp-content/uploads/2024/11/Security-Featured-Image-06-150x150.jpg</webfeeds:featuredImage></item>
<item>
<feedburner:origLink>https://www.baeldung.com/maven-pom-missing-tools-jar</feedburner:origLink>
		<title>How to Fix the Error: Missing Artifact com.sun:tools:jar in pom.xml Files</title>
		<link>https://feeds.feedblitz.com/~/972630176/0/baeldung</link>
					<comments>https://feeds.feedblitz.com/~/972630176/0/baeldung#respond</comments>
		
		<dc:creator><![CDATA[Hiks Gerganov]]></dc:creator>
		<pubDate>Sun, 08 Nov 2026 13:31:31 +0000</pubDate>
				<category><![CDATA[JVM]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Maven Basics]]></category>
		<category><![CDATA[OpenJDK]]></category>
		<guid isPermaLink="false">https://www.baeldung.com/?p=205350</guid>
					<description><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-12-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="max-width:100% !important;height:auto !important;float: left; margin-right: 5px;" loading="lazy" /><p>Learn how to handle a missing tools.jar on newer JDK versions that may be defined as a system dependency in an older Maven project.</p>
<p>The post <a rel="NOFOLLOW" href="https://feeds.feedblitz.com/~/972630176/0/baeldung">How to Fix the Error: Missing Artifact <em>com.sun:tools:jar</em> in <em>pom.xml</em> Files</a> first appeared on <a rel="NOFOLLOW" href="https://www.baeldung.com">Baeldung</a>.</p><div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972630176/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972630176/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f07%2fJava-Featured-12-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972630176/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972630176/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972630176/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/maven-pom-missing-tools-jar#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/maven-pom-missing-tools-jar/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</description>
										<content:encoded><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-12-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="float: left; margin-right: 5px;" decoding="async" loading="lazy" srcset="https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-12-1024x536.jpg 1024w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-12-300x157.jpg 300w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-12-768x402.jpg 768w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-12-100x52.jpg 100w, https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-12.jpg 1200w" sizes="auto, (max-width: 580px) 100vw, 580px" /><h2 id="bd-overview" data-id="overview">1. Overview</h2>
<div class="bd-anchor" id="overview"></div>
<p>When working with older Java repositories, especially Maven projects created for Java 8 or earlier, Eclipse may report an error related to the <em>com.sun:tools</em> dependency:</p>
<pre><code class="language-text">Missing artifact com.sun:tools:jar:1.6</code></pre>
<p>Similarly, an Ant build may fail with an analogous message:</p>
<pre><code class="language-text">Unable to locate tools.jar</code></pre>
<p>On the command line, Maven reports the missing dependency and its expected path:</p>
<pre><code class="language-text">[ERROR] Could not resolve dependencies for project ...
[ERROR] dependency: com.sun:tools:jar:1.8 (system)
[ERROR] Could not find artifact com.sun:tools:jar:1.8 at specified path /opt/jdk-21/../lib/tools.jar</code></pre>
<p>In this tutorial, <strong>we examine why the <em>com.sun:tools:jar</em> artifact might be missing and how to fix the problem</strong>.</p>
<h2 id="bd-understanding-the-problem" data-id="understanding-the-problem">2. Understanding the Problem</h2>
<div class="bd-anchor" id="understanding-the-problem"></div>
<p>Older libraries and Maven projects sometimes declare <em>tools.jar</em> as a <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/maven-dependency-scopes">system dependency</a>:</p>
<pre><code class="language-xml">&lt;dependency&gt;
    &lt;groupId&gt;com.sun&lt;/groupId&gt;
    &lt;artifactId&gt;tools&lt;/artifactId&gt;
    &lt;version&gt;1.8&lt;/version&gt;
    &lt;scope&gt;system&lt;/scope&gt;
    &lt;systemPath&gt;${java.home}/../lib/tools.jar&lt;/systemPath&gt;
&lt;/dependency&gt;</code></pre>
<p>On JDK 8, <em>java.home</em> is the <em>jre</em> directory of the JDK, so <em>${java.home}/../lib/tools.jar</em> points to the JDK path <em>lib/tools.jar</em>. Conversely, standalone JRE instances have no such file.</p>
<p><strong>Unlike ordinary Maven dependencies, a dependency with the <em>system</em> scope doesn&#8217;t come from Maven Central or another repository.</strong> Instead, Maven expects the JAR to exist at the location specified by <em>systemPath</em>.</p>
<p><strong>In JDK 8 and earlier, <em>tools.jar</em> was part of the JDK installation</strong> and contained classes used by Java development tools.</p>
<h2 id="bd-using-a-jre-instead-of-a-jdk" data-id="using-a-jre-instead-of-a-jdk">3. Using a JRE Instead of a JDK</h2>
<div class="bd-anchor" id="using-a-jre-instead-of-a-jdk"></div>
<p>A standalone Java 8 <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/jvm-vs-jre-vs-jdk">JRE</a> doesn&#8217;t include <em>tools.jar</em>.</p>
<p><strong>We first confirm which Java installation Maven uses</strong>:</p>
<pre><code class="language-bash">mvn -version</code></pre>
<p>Recent Maven versions label the runtime path <em>runtime:</em>, while older versions use <em>Java home:</em>. A standalone JRE path such as <em>jre1.8.0_301</em> indicates a potential problem. On the other hand, <em>jdk1.8.0_301/jre</em> should be normal for JDK 8.</p>
<p><strong>To correct the situation, we can <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-home-on-windows-mac-os-x-linux">set <em>JAVA_HOME</em></a> to the relevant JDK directory</strong>. Let&#8217;s see an example on Linux or macOS:</p>
<pre><code class="language-bash">export JAVA_HOME=/opt/jdk1.8.0_301</code></pre>
<p>In this case, <strong><em>JAVA_HOME</em> points to the JDK root rather than its <em>bin</em> directory</strong>.</p>
<h2 id="bd-ide-using-the-wrong-java-installation" data-id="ide-using-the-wrong-java-installation">4. IDE Using the Wrong Java Installation</h2>
<div class="bd-anchor" id="ide-using-the-wrong-java-installation"></div>
<p>In Eclipse, we can first check the configured Java installations under <em>Preferences &gt; Java &gt; Installed JREs</em> and make sure an appropriate JDK is selected. For an older Eclipse version supporting Java 8, we can explicitly configure the Eclipse JVM using the <em>-vm</em> option in <em>eclipse.ini</em>:</p>
<pre><code class="language-text">[...]
-vm
C:\jdk1.8.0_301\bin\javaw.exe
-vmargs
[...]</code></pre>
<p>After restarting Eclipse, we update or reimport the Maven project. Notably, individual Maven run configurations can have their own JRE setting.</p>
<h2 id="bd-building-with-jdk-9-or-later" data-id="building-with-jdk-9-or-later">5. Building With JDK 9 or Later</h2>
<div class="bd-anchor" id="building-with-jdk-9-or-later"></div>
<p><strong>Starting with JDK 9, <em>tools.jar</em> no longer exists</strong>. Public tool APIs remain available through modules such as <em>jdk.compiler</em> (javac and Compiler Tree APIs) and <em>jdk.attach</em> (Attach API), without an extra JAR dependency.</p>
<p>Maven also prints a warning that suggests the wrong fix here:</p>
<pre><code class="language-text">[WARNING] 'dependencies.dependency.systemPath' for com.sun:tools:jar refers to a non-existing file /opt/jdk-21/../lib/tools.jar. Please verify that you run Maven using a JDK and not just a JRE.</code></pre>
<p>Since even a full JDK 9 or later has no <em>tools.jar</em>, switching to a JDK doesn&#8217;t resolve it.</p>
<p>For projects supporting both JDK 8 and newer ones, we can move the dependency into a JDK 8-only <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/maven-profiles">profile</a>:</p>
<pre><code class="language-xml">&lt;profiles&gt;
    &lt;profile&gt;
        &lt;id&gt;jdk8-tools&lt;/id&gt;
        &lt;activation&gt;
            &lt;jdk&gt;1.8&lt;/jdk&gt;
        &lt;/activation&gt;
        &lt;dependencies&gt;
            &lt;dependency&gt;
                &lt;groupId&gt;com.sun&lt;/groupId&gt;
                &lt;artifactId&gt;tools&lt;/artifactId&gt;
                &lt;version&gt;1.8&lt;/version&gt;
                &lt;scope&gt;system&lt;/scope&gt;
                &lt;systemPath&gt;${java.home}/../lib/tools.jar&lt;/systemPath&gt;
            &lt;/dependency&gt;
        &lt;/dependencies&gt;
    &lt;/profile&gt;
&lt;/profiles&gt;</code></pre>
<p>If a third-party library, Maven plugin, or framework declares <em>com.sun:tools</em>, <strong>we should upgrade that component to a version compatible with newer Java releases</strong>.</p>
<h2 id="bd-excluding-an-obsolete-dependency" data-id="excluding-an-obsolete-dependency">6. Excluding an Obsolete Dependency</h2>
<div class="bd-anchor" id="excluding-an-obsolete-dependency"></div>
<p>To locate the declaration, let&#8217;s check the effective POM:</p>
<pre><code class="language-bash">mvn help:effective-pom</code></pre>
<p>This includes declarations from the project, its parents, and active profiles, but not transitive dependencies. For those, we use another command:</p>
<pre><code class="language-bash">mvn dependency:tree -Dincludes=com.sun:tools</code></pre>
<p><strong>If the newer JDK already provides the functionality required by the library and the dependency on <em>tools.jar</em> is obsolete, we may be able to exclude it</strong>:</p>
<pre><code class="language-xml">&lt;dependency&gt;
    &lt;groupId&gt;com.example&lt;/groupId&gt;
    &lt;artifactId&gt;legacy-library&lt;/artifactId&gt;
    &lt;version&gt;1.0.0&lt;/version&gt;
    &lt;exclusions&gt;
        &lt;exclusion&gt;
            &lt;groupId&gt;com.sun&lt;/groupId&gt;
            &lt;artifactId&gt;tools&lt;/artifactId&gt;
        &lt;/exclusion&gt;
    &lt;/exclusions&gt;
&lt;/dependency&gt;</code></pre>
<p><strong>This solution is appropriate only when the library works with the target JDK APIs.</strong> Otherwise, the Maven error may be replaced by compilation or runtime errors.</p>
<h2 id="bd-avoiding-manual-toolsjar-workarounds" data-id="avoiding-manual-toolsjar-workarounds">7. Avoiding Manual <em>tools.jar</em> Workarounds</h2>
<div class="bd-anchor" id="avoiding-manual-toolsjar-workarounds"></div>
<p>Copying or manually installing <em>tools.jar</em> can make the build depend on local modifications and cause inconsistent behavior between development machines and CI environments. <strong>Maven supports system-scoped dependencies, but <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html">their use is discouraged</a></strong>.</p>
<h2 id="bd-conclusion" data-id="conclusion">8. Conclusion</h2>
<div class="bd-anchor" id="conclusion"></div>
<p>In this article, we examined the <em>Missing artifact com.sun:tools:jar</em> and <em>Unable to locate tools.jar</em> errors.</p>
<p>For Java 8 and earlier, the problem usually means that Maven or the IDE is using a JRE instead of the required JDK, so configuring <em>JAVA_HOME</em> and the IDE JVM resolves the issue. Starting with Java 9, <em>tools.jar</em> no longer exists, so old dependencies that require it need to be upgraded, removed, or built with an appropriate legacy JDK.</p><p>The post <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/maven-pom-missing-tools-jar">How to Fix the Error: Missing Artifact <em>com.sun:tools:jar</em> in <em>pom.xml</em> Files</a> first appeared on <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com">Baeldung</a>.</p><Img align="left" border="0" height="1" width="1" alt="" style="border:0;float:left;margin:0;padding:0;width:1px!important;height:1px!important;" hspace="0" src="https://feeds.feedblitz.com/~/i/972630176/0/baeldung">
<div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972630176/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972630176/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f07%2fJava-Featured-12-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972630176/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972630176/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972630176/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/maven-pom-missing-tools-jar#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/maven-pom-missing-tools-jar/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</content:encoded>
					
					<wfw:commentRss>https://feeds.feedblitz.com/~/972630176/0/baeldung/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<webfeeds:featuredImage>https://www.baeldung.com/wp-content/uploads/2024/07/Java-Featured-12-150x150.jpg</webfeeds:featuredImage></item>
<item>
<feedburner:origLink>https://www.baeldung.com/selenium-webdriver-automate-shadow-dom</feedburner:origLink>
		<title>Automating Shadow DOM in Selenium WebDriver</title>
		<link>https://feeds.feedblitz.com/~/972628949/0/baeldung</link>
					<comments>https://feeds.feedblitz.com/~/972628949/0/baeldung#respond</comments>
		
		<dc:creator><![CDATA[Aidela Karamyan]]></dc:creator>
		<pubDate>Sun, 08 Nov 2026 13:20:05 +0000</pubDate>
				<category><![CDATA[Java Web]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Selenium]]></category>
		<guid isPermaLink="false">https://www.baeldung.com/?p=205327</guid>
					<description><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/11/featured-images-selenium-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="max-width:100% !important;height:auto !important;float: left; margin-right: 5px;" loading="lazy" /><p>Learn how to access shadow DOM elements with Selenium, understand shadow-root boundaries, and compare native WebDriver support with JavaScript-based approaches.</p>
<p>The post <a rel="NOFOLLOW" href="https://feeds.feedblitz.com/~/972628949/0/baeldung">Automating Shadow DOM in Selenium WebDriver</a> first appeared on <a rel="NOFOLLOW" href="https://www.baeldung.com">Baeldung</a>.</p><div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972628949/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972628949/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f11%2ffeatured-images-selenium-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972628949/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972628949/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972628949/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/selenium-webdriver-automate-shadow-dom#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/selenium-webdriver-automate-shadow-dom/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</description>
										<content:encoded><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2024/11/featured-images-selenium-1024x536.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="float: left; margin-right: 5px;" decoding="async" loading="lazy" srcset="https://www.baeldung.com/wp-content/uploads/2024/11/featured-images-selenium-1024x536.jpg 1024w, https://www.baeldung.com/wp-content/uploads/2024/11/featured-images-selenium-300x157.jpg 300w, https://www.baeldung.com/wp-content/uploads/2024/11/featured-images-selenium-768x402.jpg 768w, https://www.baeldung.com/wp-content/uploads/2024/11/featured-images-selenium-100x52.jpg 100w, https://www.baeldung.com/wp-content/uploads/2024/11/featured-images-selenium-600x314.jpg 600w, https://www.baeldung.com/wp-content/uploads/2024/11/featured-images-selenium.jpg 1200w" sizes="auto, (max-width: 580px) 100vw, 580px" /><h2 id="bd-introduction" data-id="introduction">1. Introduction</h2>
<div class="bd-anchor" id="introduction"></div>
<p><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM">Shadow DOM</a> is a powerful encapsulation technique that has many advantages for development. As a browser-native web standard, it&#8217;s widely supported by modern browsers. However, it brings challenges when it comes to automation. Moreover, the <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/selenium-automated-browser-testing">Selenium</a> architecture further limits the scope of actions.</p>
<p>Essentially, <strong>shadow DOM is a fragment of the DOM tree isolated from the regular DOM</strong>, also known as the light DOM. Markup, styles, and scripts are hidden from the light DOM and vice versa (with some exceptions). Thus, only limited deliberate interaction is possible.</p>
<p>In this tutorial, we&#8217;ll see how to work with shadow DOM. Further, we&#8217;ll look into an example with Selenium and compare modern and legacy approaches.</p>
<h2 id="bd-understanding-shadow-dom" data-id="understanding-shadow-dom">2. Understanding Shadow DOM</h2>
<div class="bd-anchor" id="understanding-shadow-dom"></div>
<p>To begin with, let&#8217;s understand why use shadow DOM in automation. We frequently see shadow DOM in custom elements and UI libraries. There, encapsulation ensures no global style or code accidentally interferes with the component presentation and functionality. Still, we often need to interact with web components encapsulated inside. Also, we might need to validate the styles and the rendered content.</p>
<h3 id="bd-1-the-selenium-approach" data-id="1-the-selenium-approach">2.1. The Selenium Approach</h3>
<div class="bd-anchor" id="1-the-selenium-approach"></div>
<p>Selenium works with shadow DOM in a quite manual way compared to other popular automation tools. The limitation comes from its architecture as <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-selenium-webdriver-submit-vs-click#how-selenium-works">a WebDriver messenger</a>. Besides, standard functions for finding elements in the light DOM don&#8217;t work with the shadow DOM. <strong>If we try to find a shadow tree element using <em>driver.findElement()</em>, we get <em>NoSuchElementException</em></strong>. To pierce the <em>shadow boundary</em>, we need access to the <em>shadow root</em>, the root element of the shadow tree.</p>
<p>The algorithm is straightforward. <strong>First, we find the <em>shadow host</em>, the element to which the shadow tree is attached, then we get its shadow root</strong>. From there, we have access to the shadow DOM and can use, for example, CSS selectors to find elements. If no shadow root exists, Selenium throws <em>NoSuchShadowRootException</em>.</p>
<h3 id="bd-2-types" data-id="2-types">2.2. Types</h3>
<div class="bd-anchor" id="2-types"></div>
<p>We can inspect the shadow root type in the browser developer tools:</p>
<img loading="lazy" decoding="async" class="alignnone wp-image-205328 size-full" src="https://www.baeldung.com/wp-content/uploads/2026/11/open-shadow-root.png" alt="Open shadow root inspection" width="1398" height="650" srcset="https://www.baeldung.com/wp-content/uploads/2026/11/open-shadow-root.png 1398w, https://www.baeldung.com/wp-content/uploads/2026/11/open-shadow-root-300x139.png 300w, https://www.baeldung.com/wp-content/uploads/2026/11/open-shadow-root-1024x476.png 1024w, https://www.baeldung.com/wp-content/uploads/2026/11/open-shadow-root-768x357.png 768w, https://www.baeldung.com/wp-content/uploads/2026/11/open-shadow-root-100x46.png 100w, https://www.baeldung.com/wp-content/uploads/2026/11/open-shadow-root-600x279.png 600w" sizes="auto, (max-width: 1398px) 100vw, 1398px" />
<p>Text in parentheses next to <em>#shadow-root</em> tells us the type:</p>
<ul>
<li>open</li>
<li>closed</li>
<li>user-agent</li>
</ul>
<p>In JavaScript, the <em>shadowRoot</em> property of a host element returns <em>null</em> when shadow root is absent or closed. However, WebDriver implementations access shadow root via a different mechanism rather than through this JavaScript property. Since <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.w3.org/TR/webdriver2/#get-element-shadow-root">WebDriver specification</a> doesn&#8217;t mention closed shadow root, its instructions on <em>null</em> case are open to interpretation. As a result, <strong>Selenium&#8217;s shadow root API provides closed shadow root access in supporting browser drivers</strong>.</p>
<p>In experiments we conducted, ChromeDriver returned shadow root and allowed to query the shadow DOM. Yet, interactions with the queried elements threw <em>ElementNotInteractableException</em>. In comparison, GeckoDriver provided both access and interactability. These results show that, alongside closed shadow root support, we also need further investigation into element interactability across browser drivers.</p>
<p>If direct access to closed shadow root isn&#8217;t available, we can consider two workarounds. When the code isn&#8217;t from a third party, we can ask the development team to leave a testing backdoor, such as a global reference hook. Additionally, we can utilize the fact that a closed shadow tree is still part of the browser accessibility and focus tree. So, after locating the shadow host, we can bypass the shadow boundary using <em>Actions API</em> to simulate user keyboard inputs, such as <em>Tab</em> and <em>Enter</em> key events. However, this second approach is flaky.</p>
<p>The last shadow root type is <em>user-agent</em>, used for built-in elements, such as <em>&lt;video&gt;</em>, <em>&lt;select&gt;</em>, and <em>&lt;input type=&#8221;range&#8221;&gt;</em>. By default, this type of shadow root appears closed in the developer tools, but we can often change the browser configuration. Though normally, we won&#8217;t need to test the browser implementation of such components.</p>
<h3 id="bd-3-xpath" data-id="3-xpath">2.3. XPath</h3>
<div class="bd-anchor" id="3-xpath"></div>
<p>Since shadow DOM is an isolated DOM tree, it might seem intuitive to work with <em>XPath</em> from the shadow root. In fact, the <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.w3.org/TR/webdriver/#element-retrieval">WebDriver specification</a> lists it as a supported locator strategy. However, <strong>we cannot locate a shadow root or its child elements using <em>XPath</em></strong>.</p>
<p>As of the writing of this article, mainstream browser driver implementations, like ChromeDriver and GeckoDriver, don&#8217;t support that. The reason is not made public. A possible technical challenge could be that a shadow root isn&#8217;t a <em>Document</em> but a <em>DocumentFragment</em>. Meanwhile, <em>DocumentFragment</em> has no direct API for <em>XPath</em> evaluation.</p>
<h3 id="bd-4-nesting" data-id="4-nesting">2.4. Nesting</h3>
<div class="bd-anchor" id="4-nesting"></div>
<p><strong>Shadow trees can be nested, with no limit on the depth</strong>. Nesting happens when we add an element containing a shadow root to another shadow tree. Although rare in standard web development, it&#8217;s a common pattern in component libraries.</p>
<p>For instance, a custom drop-down element can be inside a custom form:</p>
<pre><code class="html">&lt;settings-form&gt;
  #shadow-root (open)
  &lt;div class="form-container"&gt;
    &lt;div class="field-group"&gt;
      &lt;label&gt;Country&lt;/label&gt;
      &lt;country-dropdown&gt;
        #shadow-root (closed)
      &lt;/country-dropdown&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/settings-form&gt;
</code></pre>
<p><strong>When working with nested shadow roots, we need to recursively traverse them until we reach the shadow root containing our target element</strong>.</p>
<h3 id="bd-5-event-propagation" data-id="5-event-propagation">2.5. Event Propagation</h3>
<div class="bd-anchor" id="5-event-propagation"></div>
<p>Being able to catch shadow DOM events is important when doing issue root cause analyses. In fact, <strong>shadow DOM events can propagate to the light DOM</strong>. When its <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://developer.mozilla.org/en-US/docs/Web/API/Event/composed"><em>composed</em></a> flag is set to <em>true</em>, the event crosses the shadow boundary. Another important flag is <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://developer.mozilla.org/en-US/docs/Web/API/Event/bubbles"><em>bubbles</em></a>, indicating whether the event bubbles up from the target element.</p>
<p>Both flags are <em>true</em> for click, touch, or keyboard events. The <em>mouseenter</em> and <em>mouseleave</em> events neither bubble nor cross the shadow boundary. Finally, a <em>capture: true</em> listener listens to events that don&#8217;t bubble up and have <em>composed: true</em>, such as <em>blur</em> and <em>focus</em>.</p>
<p>After crossing the shadow boundary, the event target changes to the shadow host. For an event originating inside an open shadow root, an outside listener can retrieve the original target from the first element of the array returned by <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath"><em>composedPath()</em></a>. For a closed root, the path hides its internal nodes. In addition, we use <em>JavascriptExecutor</em> for listening to events as well as retrieving the original target.</p>
<h2 id="bd-automating-with-selenium" data-id="automating-with-selenium">3. Automating With Selenium</h2>
<div class="bd-anchor" id="automating-with-selenium"></div>
<p>Now, let’s see Selenium in action. We&#8217;ll look into two available approaches, the modern approach and the legacy approach which can be useful in certain cases.</p>
<h3 id="bd-1-prerequisites-and-setup" data-id="1-prerequisites-and-setup">3.1. Prerequisites and Setup</h3>
<div class="bd-anchor" id="1-prerequisites-and-setup"></div>
<p>First, we set up a simple Selenium test. To do this, we assume basic familiarity with several topics:</p>
<ul>
<li>Java development environment</li>
<li>initializing a <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/maven">Maven</a> project</li>
<li>running tests</li>
<li>JavaScript</li>
</ul>
<p>For the example code, we use a quickstart Maven project and add Selenium WebDriver, <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/selenium-webdrivermanager">WebDriver Manager</a>, and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/junit-5">JUnit</a> packages to the <em>pom.xml</em> file:</p>
<pre><code class="xml">&lt;dependencies&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
    &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;
    &lt;version&gt;4.46.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;io.github.bonigarcia&lt;/groupId&gt;
      &lt;artifactId&gt;webdrivermanager&lt;/artifactId&gt;
      &lt;version&gt;6.3.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.junit.jupiter&lt;/groupId&gt;
    &lt;artifactId&gt;junit-jupiter&lt;/artifactId&gt;
    &lt;version&gt;5.11.0&lt;/version&gt;
    &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
&lt;/dependencies&gt;
</code></pre>
<p>In this case, <strong>we use WebDriver Manager to automatically download and set up the correct version of the browser driver we use in the tests</strong>. We also use JUnit to annotate and organize the sample code.</p>
<p>Next, we create a sample test file in the <em>src/test/java</em> directory of the project. Let&#8217;s name it <em>ShadowSearchTest.java</em> and add setup code to get started:</p>
<pre><code class="java">public class ShadowSearchTest {
    private WebDriver driver;
    @BeforeEach
    void setup() {
        WebDriverManager.chromedriver().setup();
        driver = new ChromeDriver();
    }
    @AfterEach
    void teardown() {
        if (driver != null) {
            driver.quit();
        }
    }
    // add tests here
}
</code></pre>
<p>In the setup and teardown functions, we initialize the Chrome driver before and quit the driver after each test.</p>
<p>Finally, to the <em>src/test/resources</em> directory, we add a sample web code that creates a web page with shadow DOM:</p>
<pre><code class="html">&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;Shadow DOM Example&lt;/title&gt;
    &lt;style&gt;
        body {
            font-family: sans-serif;
            margin: 20px;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;h1&gt;Light DOM&lt;/h1&gt;
    &lt;div id="shadow-host"&gt;&lt;/div&gt;
    &lt;script&gt;
        const host = document.getElementById('shadow-host');
        const root = host.attachShadow({ mode: 'open' });
        root.innerHTML = `
            &lt;style&gt;
                .wrapper {
                    border: 1px solid #ccc;
                    padding: 0 20px 20px;
                }
                input, button {
                    padding: 5px;
                }
            &lt;/style&gt;
            &lt;div class="wrapper"&gt;
                &lt;h2&gt;Shadow DOM&lt;/h2&gt;
                &lt;input type="text" id="search-input" placeholder="Search Google..."&gt;
                &lt;button id="search-button"&gt;Search&lt;/button&gt;
            &lt;/div&gt;
        `;
        root.getElementById('search-button').addEventListener('click', () =&gt; {
            const query = root.getElementById('search-input').value.trim();
            const encodedQuery = encodeURIComponent(query);
            if (query) {
                window.location.href= "https://google.com/search?q=" + encodedQuery;
            }
        });
    &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>Let&#8217;s see the result:
<br>
<img loading="lazy" decoding="async" class="alignnone wp-image-205329 size-full" src="https://www.baeldung.com/wp-content/uploads/2026/11/shadow-dom-example.png" alt="Rendered example shadow DOM" width="1480" height="838" srcset="https://www.baeldung.com/wp-content/uploads/2026/11/shadow-dom-example.png 1480w, https://www.baeldung.com/wp-content/uploads/2026/11/shadow-dom-example-300x170.png 300w, https://www.baeldung.com/wp-content/uploads/2026/11/shadow-dom-example-1024x580.png 1024w, https://www.baeldung.com/wp-content/uploads/2026/11/shadow-dom-example-768x435.png 768w, https://www.baeldung.com/wp-content/uploads/2026/11/shadow-dom-example-100x57.png 100w, https://www.baeldung.com/wp-content/uploads/2026/11/shadow-dom-example-600x340.png 600w" sizes="auto, (max-width: 1480px) 100vw, 1480px" /></p>
<p>As expected, we have a simple Google search form inside a shadow DOM.</p>
<h3 id="bd-2-the-modern-approach" data-id="2-the-modern-approach">3.2. The Modern Approach</h3>
<div class="bd-anchor" id="2-the-modern-approach"></div>
<p><strong>Selenium 4 introduced native support for shadow DOM through the <em>getShadowRoot()</em> function</strong>. It returns <em>SearchContext</em>, an interface for finding elements, which enables the lookup of elements inside  the shadow tree of that specific shadow root.</p>
<p>Let&#8217;s automate a Google search for the example we set up using the algorithm discussed earlier:</p>
<ol>
<li>Find the shadow host element</li>
<li>Get its shadow root</li>
<li>Find the input element</li>
<li>Input a search query</li>
<li>Find the submit button</li>
<li>Click on the button</li>
<li>Wait for navigation</li>
</ol>
<p>Next, we add a test after the setup functions:</p>
<pre><code class="java">    @Test
    void googleSearchFromShadowDom() throws InterruptedException, UnsupportedEncodingException {
        try {
            // Sets up driver wait
            WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
            // Loads local HTML file
            URL htmlUrl = getClass().getClassLoader().getResource("shadow-sample.html");
            driver.get(htmlUrl.toString());
            String shadowSampleUrl = driver.getCurrentUrl();
            // 1. Finds shadow host
            WebElement shadowHost = driver.findElement(By.cssSelector("#shadow-host"));
            // 2. Finds shadow root
            SearchContext shadowRoot = wait.until(driver -&gt; {
                try {
                    return shadowHost.getShadowRoot();
                } catch (NoSuchShadowRootException e) {
                    return null;
                }
            });
            // 3, 4. Finds input element and inputs query
            WebElement searchField = shadowRoot.findElement(By.cssSelector("#search-input"));
            searchField.sendKeys("shadow dom");
            TimeUnit.SECONDS.sleep(2);
            // 5, 6. Finds submit button and clicks it
            WebElement searchButton = shadowRoot.findElement(By.cssSelector("#search-button"));
            searchButton.click();
            // 7. Waits for navigation
            wait.until(driver -&gt; !driver.getCurrentUrl().equals(shadowSampleUrl));
            TimeUnit.SECONDS.sleep(2);
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }
</code></pre>
<p>Importantly, we use a waiting mechanism on the shadow root because it&#8217;s loaded dynamically.
<br>
Elements inside it don&#8217;t need waiting in this example. Also, we use timers to observe automation steps.</p>
<p>The URL-change wait confirms navigation away from the sample page, but doesn&#8217;t verify successful Google search results. Google may display a bot check, so we shouldn&#8217;t rely on its results page to validate this demonstration.</p>
<h3 id="bd-3-the-legacy-approach" data-id="3-the-legacy-approach">3.3. The Legacy Approach</h3>
<div class="bd-anchor" id="3-the-legacy-approach"></div>
<p>Selenium 3 and older versions can only use <em>JavascriptExecutor</em> to work with shadow DOM. So, we run a single script that finds the shadow root, queries and returns the element:</p>
<pre><code class="java">WebDriverWait wait = new WebDriverWait(driver, 10);
JavascriptExecutor js = (JavascriptExecutor) driver;
URL htmlUrl = getClass().getClassLoader().getResource("shadow-sample.html");
driver.get(htmlUrl.toString());
WebElement shadowHost = driver.findElement(By.cssSelector("#shadow-host"));
WebElement searchField = wait.until(driver -&gt; {
    return (WebElement) js.executeScript(
            "return arguments[0].shadowRoot.querySelector('#search-input')",
            shadowHost
    );
});
searchField.sendKeys("shadow dom");
</code></pre>
<p>Here, <em>arguments[0]</em> resolves to the shadow host. We work with the returned <em>WebElement</em> as usual.</p>
<p>We can use this legacy approach in modern Selenium with the convenience of having a <em>SearchContext</em> returned:</p>
<pre><code class="java">SearchContext shadowRoot = wait.until(driver -&gt; {
    return (SearchContext) js.executeScript("return arguments[0].shadowRoot", shadowHost);
});
</code></pre>
<p>Thus, we find just the shadow root and cast it to <em>SearchContext</em> before returning. Afterwards, we have a shadow root in the Java environment we can work with the same way we did in the modern approach example.</p>
<p>In comparison, it seems intuitive to find the target element inside the same script, thereby optimizing and sending only one request to WebDriver API instead of two. This approach could also eliminate verbose code when working with nested shadow DOMs. However, the optimization comes with a cost.</p>
<p>We can use <em>WebDriverWait</em> to poll JavaScript lookups, including lookups through nested shadow roots. For dynamically attached roots, the script should check each root and return <em>null</em> until the target element exists. Longer scripts can make failures harder to diagnose, so we should keep these lookups small and readable.</p>
<p><strong>We should always prioritize reliability, particularly the elimination of flaky tests, over execution speed</strong>.</p>
<h2 id="bd-conclusion" data-id="conclusion">4. Conclusion</h2>
<div class="bd-anchor" id="conclusion"></div>
<p>In this article, we looked at what shadow DOM is and the nuances of working with it. Then, we implemented an example using Selenium. Finally, we examined the legacy approach and its modern applications.</p>
<p>While working with shadow roots in Selenium can be cumbersome, it&#8217;s important to understand its capabilities and limitations to effectively work with modern web applications.</p>
<p>As always, all the source code is available <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/eugenp/tutorials/tree/master/testing-modules/selenium-4/">over on GitHub</a>.</p><p>The post <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/selenium-webdriver-automate-shadow-dom">Automating Shadow DOM in Selenium WebDriver</a> first appeared on <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com">Baeldung</a>.</p><Img align="left" border="0" height="1" width="1" alt="" style="border:0;float:left;margin:0;padding:0;width:1px!important;height:1px!important;" hspace="0" src="https://feeds.feedblitz.com/~/i/972628949/0/baeldung">
<div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972628949/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972628949/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2024%2f11%2ffeatured-images-selenium-1024x536.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972628949/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972628949/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972628949/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/selenium-webdriver-automate-shadow-dom#respond"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/selenium-webdriver-automate-shadow-dom/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&#160;</div>]]>
</content:encoded>
					
					<wfw:commentRss>https://feeds.feedblitz.com/~/972628949/0/baeldung/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<webfeeds:featuredImage>https://www.baeldung.com/wp-content/uploads/2024/11/featured-images-selenium-150x150.jpg</webfeeds:featuredImage></item>
<item>
<feedburner:origLink>https://www.baeldung.com/java-weekly-670</feedburner:origLink>
		<title>Java Weekly, Issue 670</title>
		<link>https://feeds.feedblitz.com/~/972505319/0/baeldung</link>
					<comments>https://feeds.feedblitz.com/~/972505319/0/baeldung#comments</comments>
		
		<dc:creator><![CDATA[baeldung]]></dc:creator>
		<pubDate>Fri, 06 Nov 2026 17:35:09 +0000</pubDate>
				<category><![CDATA[Weekly Review]]></category>
		<category><![CDATA[no-ads]]></category>
		<category><![CDATA[no-after-post]]></category>
		<category><![CDATA[no-before-post]]></category>
		<category><![CDATA[no-optins]]></category>
		<guid isPermaLink="false">https://www.baeldung.com/?p=205372</guid>
					<description><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="max-width:100% !important;height:auto !important;float: left; margin-right: 5px;" loading="lazy" /><p>Agentic refactoring which is actually cheap? Yes please.</p>
<p>The post <a rel="NOFOLLOW" href="https://feeds.feedblitz.com/~/972505319/0/baeldung">Java Weekly, Issue 670</a> first appeared on <a rel="NOFOLLOW" href="https://www.baeldung.com">Baeldung</a>.</p><div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972505319/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972505319/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2016%2f10%2fsocial-Weekly-Reviews-4.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972505319/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972505319/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972505319/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/java-weekly-670#comments"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/java-weekly-670/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&nbsp;
<div style="clear:left;"><a rel="NOFOLLOW" href="https://www.baeldung.com/java-weekly-670#comments"><h3>Comments</h3></a><ul><li><a rel="NOFOLLOW" href="https://www.baeldung.com/java-weekly-670#comment-15706">Thanks for mentioning Dukehoff MCP :-). We've got more cool ...</a> <i>by Toni Epple</i></ul></div>&#160;</div>]]>
</description>
										<content:encoded><![CDATA[<img src="https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" style="float: left; margin-right: 5px;" decoding="async" loading="lazy" srcset="https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4.jpg 952w, https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4-300x157.jpg 300w, https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4-768x402.jpg 768w" sizes="auto, (max-width: 580px) 100vw, 580px" /><h2 style="text-align: left" id="bd-spring-and-java" data-id="spring-and-java">1.<strong> Spring and Java</strong></h2>
<div class="bd-anchor" id="spring-and-java"></div>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/maven-build-cache-in-practice/">&gt;&gt; The Maven Build Cache in Practice</a></strong> [<span style="color: #993300">foojay.io</span>]</p>
<p>What it took to bring the Maven Build Cache extension into real Azure DevOps pipelines &#8211; quite a lot. The payoff is pull request builds dropping from about 18 minutes to roughly 9. Definitely a win, at scale.</p>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://dukehoff.com/en/blog/dukehoff-mcp-for-java/">&gt;&gt; Dukehoff MCP for Java: an IDE for coding agents</a></strong> [<span style="color: #993300">dukehoff.com</span>]</p>
<p>You can hand coding agents IDE-grade refactoring tools (find usages, rename, move, change signature, safe delete, inline, plus a compile check), running headless on Apache NetBeans. A super worthwile weekend project I think.</p>
<h4><strong>Also worth reading:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/environment-post-processor/" target="_blank" rel="noopener"><strong>Spring Boot&#8217;s Hidden Secret for Configuration: EnvironmentPostProcessor</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.jetbrains.com/idea/2026/11/where-did-the-saved-bytes-go-compact-object-headers-in-intellij-idea/" target="_blank" rel="noopener"><strong>Where Did the Saved Bytes Go? Compact Object Headers in IntelliJ IDEA</strong></a> [<span style="color: #800000">jetbrains.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/optimizing-nanosecond-operations-when-the-cpu-cache-matters/" target="_blank" rel="noopener"><strong>Optimizing nanosecond operations: when the CPU cache matters</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/verified-match-explanations-spring-ai/" target="_blank" rel="noopener"><strong>No Quote, No Claim: Making an LLM Show Its Sources in Java</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://quarkus.io/blog/agentic-pr-reviewer/" target="_blank" rel="noopener"><strong>Debates, voting, and reflection loops: composing an agentic PR reviewer that costs less than a dollar</strong></a> [<span style="color: #800000">quarkus.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/rewrite-everything-in-java-not-rust/" target="_blank" rel="noopener"><strong>Rewrite Everything in Java: Not Rust</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/jvm-on-unikernel-nanos-gc-trade-offs-and-heap-uncommit/" target="_blank" rel="noopener"><strong>JVM on Unikernel Nanos — GC trade-offs and heap uncommit</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/free-java-real-risk-why-unsupported-openjdk-is-now-a-security-gamble/" target="_blank" rel="noopener"><strong>Free Java, Real Risk: Why Unsupported OpenJDK Is Now a Security Gamble</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://quarkus.io/blog/quarkus-almanac/" target="_blank" rel="noopener"><strong>Introducing the Quarkus Almanac</strong></a> [<span style="color: #800000">quarkus.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.javaspecialists.eu/archive/Issue338-Adjusting-Number-of-Carrier-Threads-Dynamically.html" target="_blank" rel="noopener"><strong>Adjusting Number of Carrier Threads Dynamically</strong></a> [<span style="color: #800000">javaspecialists.eu</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://tschatzl.github.io/2026/08/10/jdk27-g1-serial-parallel-gc-changes.html" target="_blank" rel="noopener"><strong>JDK 27 G1/Parallel/Serial GC changes</strong></a> [<span style="color: #800000">tschatzl.github.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/cheerpj-5-java-21-25-in-the-browser/" target="_blank" rel="noopener"><strong>CheerpJ 5.0: Java 21/25 in the browser, full OpenJDK, and a new WasmGC engine</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
</ul>
<h4><strong>Webinars and presentations:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/foojay-podcast-104/" target="_blank" rel="noopener"><strong>Foojay Podcast #104: 53 CVEs, Two Emergency Releases: Why Java Security Holds Up with Simon Ritter</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://inside.java/2026/11/04/devoxxbelgium-project-detroit/" target="_blank" rel="noopener"><strong>Project Detroit: From Foreign Libraries to Foreign Language Runtimes</strong></a> [<span style="color: #800000">inside.java</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://inside.java/2026/10/29/podcast-073/" target="_blank" rel="noopener"><strong>Episode 73 “Immutable Data Beyond Value Classes” [AtA]</strong></a> [<span style="color: #800000">inside.java</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://spring.io/blog/2026/10/29/a-bootiful-podcast-lukas-eder/" target="_blank" rel="noopener"><strong>A Bootiful Podcast: &#8216;Data Geekery&#8217; with JOOQ creator Lukas Eder</strong></a> [<span style="color: #800000">spring.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.infoq.com/presentations/self-hosted-observability-stack-tradeoffs/" target="_blank" rel="noopener"><strong>Wrangling Telemetry at Scale: a Guide to Self-Hosted Observability</strong></a> [<span style="color: #800000">infoq.com</span>]</li>
</ul>
<h4><strong>Time to upgrade:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://in.relation.to/2026/10/30/hibernate-reactive-5_1_0_Beta1/" target="_blank" rel="noopener"><strong>Hibernate Reactive 5.1.0.Beta1 and 5.0.0.Beta3 released</strong></a> [<span style="color: #800000">relation.to</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.jetbrains.com/idea/2026/10/intellij-idea-2026-2-4/" target="_blank" rel="noopener"><strong>IntelliJ IDEA 2026.2.4 Is Out!</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://blog.jetbrains.com/security/2026/10/compromised-emudhra-certificates-ides/" target="_blank" rel="noopener"><strong>Compromised eMudhra Certificates: Update Your JetBrains IDEs, ReSharper, .NET Tools, Toolbox App, and Gateway Now</strong></a> [<span style="color: #800000">jetbrains.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.wimdeblauwe.com/blog/2026/10/29/shadleaf-1.0-release/" target="_blank" rel="noopener"><strong>Shadleaf 1.0 release</strong></a> [<span style="color: #800000">wimdeblauwe.com</span>]</li>
<li><strong>&gt;&gt;</strong> GraalVM Community <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/graalvm/graalvm-ce-builds/releases/tag/graal-25.5.5.0.3" target="_blank" rel="noopener"><strong>25 Innovation 5 (graal 25.5.5.0.3, jdk 25.0.5.0.3)</strong></a> [<span style="color: #800000">github.com/graalvm</span>]</li>
<li><strong>&gt;&gt;</strong> Vert.x <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/eclipse-vertx/vert.x/releases/tag/5.2.3" target="_blank" rel="noopener"><strong>5.2.3</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/eclipse-vertx/vert.x/releases/tag/4.5.36" target="_blank" rel="noopener"><strong>4.5.36</strong></a> [<span style="color: #800000">github.com/eclipse-vertx</span>]</li>
<li><strong>&gt;&gt;</strong> Elasticsearch <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/elastic/elasticsearch/releases/tag/v9.5.6" target="_blank" rel="noopener"><strong>9.5.6</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/elastic/elasticsearch/releases/tag/v9.4.9" target="_blank" rel="noopener"><strong>9.4.9</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/elastic/elasticsearch/releases/tag/v8.19.24" target="_blank" rel="noopener"><strong>8.19.24</strong></a> [<span style="color: #800000">github.com/elastic</span>]</li>
<li><strong>&gt;&gt;</strong> Micronaut Core <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/micronaut-projects/micronaut-core/releases/tag/v5.2.22" target="_blank" rel="noopener"><strong>5.2.22</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/micronaut-projects/micronaut-core/releases/tag/v4.10.36" target="_blank" rel="noopener"><strong>4.10.36</strong></a> and <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://github.com/micronaut-projects/micronaut-core/releases/tag/v5.2.21" target="_blank" rel="noopener"><strong>5.2.21</strong></a> [<span style="color: #800000">github.com/micronaut-projects</span>]</li>
</ul>
<h2 style="text-align: left" id="bd-technical-amp-musings" data-id="technical-amp-musings">2.<strong> Technical &amp; Musings</strong></h2>
<div class="bd-anchor" id="technical-amp-musings"></div>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/google-drive-syncthing-tailscale/">&gt;&gt; From Google Drive to Syncthing over Tailscale</a></strong> [<span style="color: #993300">foojay.io</span>]</p>
<p>Nicolas Fränkel moves his password database to Syncthing over a Tailscale private network, with a Synology NAS as the always-on hub. Interesting to consider but obviously more work than running Drive.</p>
<h4><strong>Also worth reading:</strong></h4>
<ul>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://jacquesmattheij.com/the-ai-contradiction/" target="_blank" rel="noopener"><strong>The AI Contradiction</strong></a> [<span style="color: #800000">jacquesmattheij.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://martinfowler.com/rachels-ramblings/good-devs-wary.html" target="_blank" rel="noopener"><strong>Why are good developers so wary of agentic development?</strong></a> [<span style="color: #800000">martinfowler.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://foojay.io/today/context-is-a-budget-ai-coding-agents-team-process/" target="_blank" rel="noopener"><strong>Context Is a Budget: What Changed in Our Team&#8217;s Process When We Started Using AI Coding Agents</strong></a> [<span style="color: #800000">foojay.io</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://hamvocke.com/blog/git-log-analysis/" target="_blank" rel="noopener"><strong>Analyze Git Logs in Style With DuckDB</strong></a> [<span style="color: #800000">hamvocke.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://martinfowler.com/bliki/LLM-Voice.html" target="_blank" rel="noopener"><strong>LLM Voice</strong></a> [<span style="color: #800000">martinfowler.com</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://lucumr.pocoo.org/2026/10/29/qwen3-custom-voices/" target="_blank" rel="noopener"><strong>Custom Voices With Qwen3-TTS</strong></a> [<span style="color: #800000">pocoo.org</span>]</li>
<li><strong>&gt;&gt;</strong> <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://advancedweb.hu/shorts/how-to-get-1tb-free-egress-for-amazon-s3-via-cloudfront/" target="_blank" rel="noopener"><strong>How to get 1TB free egress for Amazon S3 via CloudFront</strong></a> [<span style="color: #800000">advancedweb.hu</span>]</li>
</ul>
<h2 style="text-align: left" id="bd-pick-of-the-week" data-id="pick-of-the-week">3.<strong> Pick of the Week</strong></h2>
<div class="bd-anchor" id="pick-of-the-week"></div>
<p><strong><a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://chriskiehl.com/article/it-is-still-ok-to-enjoy-programming">&gt;&gt; It&#8217;s still OK to enjoy programming</a></strong> [<span style="color: #993300">chriskiehl.com</span>]
<br>
</p><p>The post <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com/java-weekly-670">Java Weekly, Issue 670</a> first appeared on <a href="https://feeds.feedblitz.com/~/t/0/0/baeldung/~https://www.baeldung.com">Baeldung</a>.</p><Img align="left" border="0" height="1" width="1" alt="" style="border:0;float:left;margin:0;padding:0;width:1px!important;height:1px!important;" hspace="0" src="https://feeds.feedblitz.com/~/i/972505319/0/baeldung">
<div style="clear:both;padding-top:0.2em;"><a href="https://feeds.feedblitz.com/_/28/972505319/baeldung"><img height="20" src="https://assets.feedblitz.com/i/fblike20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/29/972505319/baeldung,https%3a%2f%2fwww.baeldung.com%2fwp-content%2fuploads%2f2016%2f10%2fsocial-Weekly-Reviews-4.jpg"><img height="20" src="https://assets.feedblitz.com/i/pinterest20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/24/972505319/baeldung"><img height="20" src="https://assets.feedblitz.com/i/x.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/19/972505319/baeldung"><img height="20" src="https://assets.feedblitz.com/i/email20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a href="https://feeds.feedblitz.com/_/20/972505319/baeldung"><img height="20" src="https://assets.feedblitz.com/i/rss20.png" style="border:0;margin:0;padding:0;"></a>&#160;<a rel="NOFOLLOW" title="View Comments" href="https://www.baeldung.com/java-weekly-670#comments"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/comments20.png"></a>&#160;<a title="Follow Comments via RSS" href="https://www.baeldung.com/java-weekly-670/feed"><img height="20" style="border:0;margin:0;padding:0;" src="https://assets.feedblitz.com/i/commentsrss20.png"></a>&nbsp;
<div style="clear:left;"><a rel="NOFOLLOW" href="https://www.baeldung.com/java-weekly-670#comments"><h3>Comments</h3></a><ul><li><a rel="NOFOLLOW" href="https://www.baeldung.com/java-weekly-670#comment-15706">Thanks for mentioning Dukehoff MCP :-). We've got more cool ...</a> <i>by Toni Epple</i></ul></div>&#160;</div>]]>
</content:encoded>
					
					<wfw:commentRss>https://feeds.feedblitz.com/~/972505319/0/baeldung/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<webfeeds:featuredImage>https://www.baeldung.com/wp-content/uploads/2016/10/social-Weekly-Reviews-4-150x150.jpg</webfeeds:featuredImage></item>
</channel></rss>

