Browse Source

Replace lenient fallback with assertion for actual annotation present

See gh-35133
pull/35151/head
Juergen Hoeller 6 months ago
parent
commit
46654a03fe
  1. 5
      spring-context/src/main/java/org/springframework/resilience/annotation/ConcurrencyLimitBeanPostProcessor.java

5
spring-context/src/main/java/org/springframework/resilience/annotation/ConcurrencyLimitBeanPostProcessor.java

@ -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;
} }

Loading…
Cancel
Save