Skip to content

Default binding properties are ignored when binding-specific properties and multi-binder environment are both defined #2262

@Nephery

Description

@Nephery

Describe the issue
Default binding properties are ignored when both spring.cloud.stream.<binder>.bindings.<binding>.consumer/producer.<property> and spring.cloud.stream.binders.<custom-binder-name>.environment.<property> are both defined.

To Reproduce
Steps to reproduce the behavior:

  1. Use the sensor-average-reactive-rabbit sample and upgrade spring-boot-starter-parent to 2.6.2 and spring-cloud.version to 2021.0.0.
  2. In this sample's application.yml, add:
spring:
  cloud:
    stream:
      binders:
        local-rabbit:
          type: rabbit
          environment:
            host: localhost

      rabbit:
        bindings:
          receive-in-0:
            consumer:
              durableSubscription: false
        default:
          consumer:
            anonymousGroupPrefix: 'test.'

management: # Not required to reproduce this issue, but I included it here to enable the actuator endpoint for the next steps
  endpoints:
    web:
      exposure:
        include: bindings
  1. Run the application.
  2. See in actuator that the receive-in-0 binding has anonymousGroupPrefix set to anonymous., ignoring the default consumer binding property that we had defined at spring.cloud.stream.rabbit.default.consumer.anonymousGroupPrefix.

Now if you were to re-run the application with either spring.cloud.stream.binders.local-rabbit.environment or spring.cloud.stream.rabbit.bindings commented out from application.yml, notice in actuator that the receive-in-0 binding has anonymousGroupPrefix set to test. as expected.

Version of the framework
spring-boot-starter-parent: 2.6.2
spring-cloud-dependencies: 2021.0.0

Expected behavior

Default binding properties should be applied when spring.cloud.stream.<binder>.bindings.<binding>.consumer/producer.<property> and spring.cloud.stream.binders.<custom-binder-name>.environment.<property> are both defined in application.yml.

In step 4 of the issue reproduction, we should have seen anonymousGroupPrefix set to test., not anonymous..

Additional context
This issue was originally found using the Solace PubSub+ binder. See SolaceProducts/solace-spring-cloud#29.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions