Skip to content

Fix Service Bus autoconfiguration for dedicated producer/consumer/processor connection details#49257

Merged
rujche merged 5 commits into
mainfrom
copilot/fix-servicebus-autoconfiguration-issue
May 26, 2026
Merged

Fix Service Bus autoconfiguration for dedicated producer/consumer/processor connection details#49257
rujche merged 5 commits into
mainfrom
copilot/fix-servicebus-autoconfiguration-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 26, 2026

This pull request improves the Service Bus autoconfiguration in the spring-cloud-azure-autoconfigure module, enabling applications to initialize dedicated producer, consumer, or processor clients using only sub-level Service Bus namespace or connection-string properties, without requiring top-level Service Bus connection configuration. The changes also expand test coverage to ensure this behavior and update the conditions for bean creation accordingly.

Service Bus Autoconfiguration Improvements:

  • Updated the autoconfiguration logic in AzureServiceBusClientBuilderConfiguration to allow initialization of Service Bus clients (producer, consumer, processor) when only sub-level (producer, consumer, or processor) namespace or connection-string properties are set, even if top-level Service Bus connection properties are not provided.
  • Extended the conditional property checks in ConfigurationWithoutConnectionDetailsBean to include sub-level (producer, consumer, processor) namespace and connection-string properties, ensuring beans are created when only these are present.

Testing Enhancements:

  • Added comprehensive tests in AzureServiceBusAutoConfigurationTests to verify that Service Bus producer, consumer, and processor clients can be configured and initialized with only their respective sub-level connection properties, without requiring top-level connection information.

Documentation:

  • Updated the CHANGELOG.md to document the fix allowing dedicated Service Bus clients to initialize with only sub-level configuration.

Dependency Updates:

  • Added missing imports for ServiceBusSenderClient, ServiceBusReceiverClient, and ServiceBusProcessorClient in the test file to support new test cases.
  • Added import for StringUtils to support new logic in the autoconfiguration class.

Copilot AI linked an issue May 26, 2026 that may be closed by this pull request
3 tasks
@rujche rujche added azure-spring All azure-spring related issues azure-spring-servicebus Spring service bus related issues. labels May 26, 2026
@rujche rujche moved this from Todo to In Progress in Spring Cloud Azure May 26, 2026
@rujche rujche added this to the 2026-06 milestone May 26, 2026
Copilot AI changed the title [WIP] Fix ServiceBus auto-configuration failure with connection details Fix Service Bus autoconfiguration for dedicated producer/consumer/processor connection details May 26, 2026
Copilot finished work on behalf of rujche May 26, 2026 01:40
Copilot AI requested a review from rujche May 26, 2026 01:40
@rujche rujche requested a review from Copilot May 26, 2026 01:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a Spring Cloud Azure Service Bus autoconfiguration regression where providing only nested connection details (producer/consumer/processor) prevented AzureServiceBusProperties from being created, causing downstream bean creation to fail.

Changes:

  • Expanded ConfigurationWithoutConnectionDetailsBean activation to also match nested Service Bus connection properties (producer/consumer/processor namespace/connection-string).
  • Guarded AzureServiceBusClientBuilderConfiguration#serviceBusClientBuilder(...) to avoid calling factory.build() when no top-level connection info (and no shared connection-string provider) exists.
  • Added an auto-configuration regression test verifying producer-only dedicated connection-string configuration works without any top-level connection info.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/implementation/servicebus/AzureServiceBusAutoConfigurationTests.java Adds regression test ensuring dedicated producer configuration can initialize without top-level Service Bus connection info.
sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/implementation/servicebus/properties/ConfigurationWithoutConnectionDetailsBean.java Broadens property-based activation to include nested producer/consumer/processor connection settings.
sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/implementation/servicebus/AzureServiceBusClientBuilderConfiguration.java Prevents global builder creation from failing when top-level namespace/connection-string are absent.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 26, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • processor-namespace.servicebus.windows.net
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/jacoco/org.jacoco.agent/0.8.14/org.jacoco.agent-0.8.14-runtime.jar=destfile=/home/REDACTED/work/azure-sdk-for-java/azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/target/jacoco-unit.exec,excludes=MET (dns block)
  • test-namespace.servicebus.windows.net
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/jacoco/org.jacoco.agent/0.8.14/org.jacoco.agent-0.8.14-runtime.jar=destfile=/home/REDACTED/work/azure-sdk-for-java/azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/target/jacoco-unit.exec,excludes=MET (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

…mespace-only variants

Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-java/sessions/c1ddba8c-d678-46f0-b6fc-a95612e9ce1d

Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
@rujche
Copy link
Copy Markdown
Member

rujche commented May 26, 2026

@copilot , Update sdk/spring/CHANGELOG.md, add content about current PR.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@rujche rujche marked this pull request as ready for review May 26, 2026 02:45
@rujche rujche requested review from a team, Netyyyy, moarychan and saragluna as code owners May 26, 2026 02:45
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 26, 2026

@copilot , Update sdk/spring/CHANGELOG.md, add content about current PR.

Updated sdk/spring/CHANGELOG.md with this PR’s Service Bus autoconfiguration fix in the 7.3.0-beta.1 (Unreleased)Spring Cloud Azure AutoconfigureBugs Fixed section. Commit: ee9e30b.

@rujche
Copy link
Copy Markdown
Member

rujche commented May 26, 2026

/azp run java - spring - tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@rujche rujche merged commit f5e5bdb into main May 26, 2026
88 checks passed
@rujche rujche deleted the copilot/fix-servicebus-autoconfiguration-issue branch May 26, 2026 05:37
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Spring Cloud Azure May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure-spring All azure-spring related issues azure-spring-servicebus Spring service bus related issues.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] ServiceBus AutoConfiguration is broken

4 participants