diff --git a/bucket4j-spring-boot-starter/src/main/java/com/giffing/bucket4j/spring/boot/starter/config/condition/OnAsynchronousPropertyCondition.java b/bucket4j-spring-boot-starter/src/main/java/com/giffing/bucket4j/spring/boot/starter/config/condition/OnAsynchronousPropertyCondition.java index 6a13b4a3..22da962b 100644 --- a/bucket4j-spring-boot-starter/src/main/java/com/giffing/bucket4j/spring/boot/starter/config/condition/OnAsynchronousPropertyCondition.java +++ b/bucket4j-spring-boot-starter/src/main/java/com/giffing/bucket4j/spring/boot/starter/config/condition/OnAsynchronousPropertyCondition.java @@ -14,6 +14,9 @@ public class OnAsynchronousPropertyCondition extends SpringBootCondition { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { var bucket4jProperties = Binder.get(context.getEnvironment()).bind("bucket4j", Bucket4JBootProperties.class).orElse(null); + if (bucket4jProperties == null) { + return ConditionOutcome.noMatch("@ConditionalOnAsynchronousPropertyCondition Bucket4jBootProperties not configured"); + } var reactiveFilterConfigurationExists = bucket4jProperties.getFilters() .stream() .anyMatch(x -> List.of(FilterMethod.WEBFLUX, FilterMethod.GATEWAY).contains(x.getFilterMethod())); diff --git a/bucket4j-spring-boot-starter/src/main/java/com/giffing/bucket4j/spring/boot/starter/config/condition/OnSynchronousPropertyCondition.java b/bucket4j-spring-boot-starter/src/main/java/com/giffing/bucket4j/spring/boot/starter/config/condition/OnSynchronousPropertyCondition.java index 8127b6cb..abe9a768 100644 --- a/bucket4j-spring-boot-starter/src/main/java/com/giffing/bucket4j/spring/boot/starter/config/condition/OnSynchronousPropertyCondition.java +++ b/bucket4j-spring-boot-starter/src/main/java/com/giffing/bucket4j/spring/boot/starter/config/condition/OnSynchronousPropertyCondition.java @@ -12,6 +12,9 @@ public class OnSynchronousPropertyCondition extends SpringBootCondition { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { var bucket4jProperties = Binder.get(context.getEnvironment()).bind("bucket4j", Bucket4JBootProperties.class).orElse(null); + if (bucket4jProperties == null) { + return ConditionOutcome.noMatch("@ConditionalOnSynchronPropertyCondition Bucket4jBootProperties not configured"); + } var methodConfigurationExists = !bucket4jProperties.getMethods().isEmpty(); var servletConfigurationExist = bucket4jProperties.getFilters().stream().anyMatch(x -> x.getFilterMethod().equals(FilterMethod.SERVLET)); if (methodConfigurationExists || servletConfigurationExist) {