Fix NullPointerException in Kinesis binder CloudWatch client creation#1652
Open
kobeomseok95 wants to merge 1 commit into
Open
Fix NullPointerException in Kinesis binder CloudWatch client creation#1652kobeomseok95 wants to merge 1 commit into
NullPointerException in Kinesis binder CloudWatch client creation#1652kobeomseok95 wants to merge 1 commit into
Conversation
`KinesisBinderConfiguration.cloudWatch()` passed the optional `AwsClientCustomizer` as `Stream.of(configurer.getIfAvailable())`, which produces a stream with a single null element when no customizer bean is defined and leads to a `NullPointerException` in `AwsClientBuilderConfigurer.configureAsyncClient()`. Use `configurer.stream()` instead, aligning with the sibling client bean methods (`amazonKinesis()`, `dynamoDB()`, `dynamoDBStreams()`). Fixes awspringgh-1651
kobeomseok95
requested review from
MatejNedic,
maciejwalkowiak and
tomazfernandes
as code owners
July 17, 2026 11:22
NullPointerException in Kinesis binder CloudWatch client creation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
Fixes a
NullPointerExceptioninKinesisBinderConfiguration.cloudWatch()that occurs whenspring.cloud.stream.kinesis.binder.kpl-kcl-enabled=trueis set, the application has at least one input binding, and noAwsClientCustomizer<CloudWatchAsyncClientBuilder>bean is registered.The method passed the optional customizer as
Stream.of(configurer.getIfAvailable()), which produces a stream containing a singlenullelement when the bean is absent, causing the NPE insideAwsClientBuilderConfigurer.configureAsyncClient(...). This change usesconfigurer.stream()instead, aligningcloudWatch()with the sibling client bean methods (amazonKinesis(),dynamoDB(),dynamoDBStreams()), and removes the now-unusedjava.util.stream.Streamimport.💡 Motivation and Context
Without this fix, enabling the KPL/KCL mode of the Kinesis binder requires registering a no-op
AwsClientCustomizer<CloudWatchAsyncClientBuilder>bean as a workaround.Fixes #1651
💚 How did you test it?
KinesisBinderConfigurationTestswith two tests:cloudWatchClientIsCreatedWhenNoCustomizerBeanIsRegistered— reproduces the reported NPE before the fix and passes after itcloudWatchClientAppliesRegisteredCustomizer— verifies a registered customizer is still applied after the changespring-cloud-aws-kinesis-stream-bindertest suite (LocalStack/Testcontainers based) — all 25 tests pass📝 Checklist
🔮 Next steps
The bug is present in the released 4.0.x line (verified on 4.0.2), so this may be worth backporting to
4.0.x.