Replace lenient fallback with assertion for actual annotation present

See gh-35133
This commit is contained in:
Juergen Hoeller 2025-07-02 11:09:53 +02:00
parent b794abd8cb
commit 46654a03fe
1 changed files with 2 additions and 3 deletions

View File

@ -20,7 +20,6 @@ import java.lang.reflect.Method;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import org.aopalliance.intercept.Joinpoint;
import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation; import org.aopalliance.intercept.MethodInvocation;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
@ -93,8 +92,8 @@ public class ConcurrencyLimitBeanPostProcessor extends AbstractBeanFactoryAwareA
} }
} }
if (interceptor == null) { if (interceptor == null) {
interceptor = (limit != null ? new ConcurrencyThrottleInterceptor(limit.value()) : Assert.state(limit != null, "No @ConcurrencyLimit annotation found");
Joinpoint::proceed); interceptor = new ConcurrencyThrottleInterceptor(limit.value());
if (!perMethod) { if (!perMethod) {
cache.classInterceptor = interceptor; cache.classInterceptor = interceptor;
} }