From 2bd6422db96fb308ba20833cf7cd02a8504e3ed8 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Mon, 29 Sep 2025 17:41:59 +0200 Subject: [PATCH] =?UTF-8?q?Update=20@=E2=81=A0ConcurrencyLimit=20documenta?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit updates the reference manual in order to reflect recent changes made to @⁠ConcurrencyLimit. See gh-35461 See gh-35470 See gh-35523 --- framework-docs/modules/ROOT/pages/core/resilience.adoc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/framework-docs/modules/ROOT/pages/core/resilience.adoc b/framework-docs/modules/ROOT/pages/core/resilience.adoc index 56a65541fa2..f644ce40912 100644 --- a/framework-docs/modules/ROOT/pages/core/resilience.adoc +++ b/framework-docs/modules/ROOT/pages/core/resilience.adoc @@ -96,17 +96,16 @@ This is meant to protect the target resource from being accessed from too many t the same time, similar to the effect of a pool size limit for a thread pool or a connection pool that blocks access if its limit is reached. -You may optionally set the limit to 1, effectively locking access to the target bean +You may optionally set the limit to `1`, effectively locking access to the target bean instance: [source,java,indent=0,subs="verbatim,quotes"] ---- -@ConcurrencyLimit(1) // <1> +@ConcurrencyLimit(1) public void sendNotification() { this.jmsClient.destination("notifications").send(...); } ---- -<1> 1 is the default, but specifying it makes the intent clearer. Such limiting is particularly useful with Virtual Threads where there is generally no thread pool limit in place. For asynchronous tasks, this can be constrained on @@ -116,6 +115,9 @@ For synchronous invocations, this annotation provides equivalent behavior throug which has been available since Spring Framework 1.0 for programmatic use with the AOP framework. +TIP: `@ConcurrencyLimit` also has a `limitString` attribute that provides property +placeholder and SpEL support, as an alternative to the `int` based examples above. + [[resilience-annotations-configuration]] == Enabling Resilient Methods