The auto-configuration for Rabbit Streams looks at the spring.rabbit.stream.* properties for various settings, sometimes falling back to a more general spring.rabbit property:
|
static EnvironmentBuilder configure(EnvironmentBuilder builder, RabbitProperties properties) { |
|
builder.lazyInitialization(true); |
|
RabbitProperties.Stream stream = properties.getStream(); |
|
PropertyMapper map = PropertyMapper.get(); |
|
map.from(stream.getHost()).to(builder::host); |
|
map.from(stream.getPort()).to(builder::port); |
|
map.from(stream.getVirtualHost()) |
|
.as(withFallback(properties::getVirtualHost)) |
|
.whenNonNull() |
|
.to(builder::virtualHost); |
|
map.from(stream.getUsername()).as(withFallback(properties::getUsername)).whenNonNull().to(builder::username); |
|
map.from(stream.getPassword()).as(withFallback(properties::getPassword)).whenNonNull().to(builder::password); |
|
return builder; |
|
} |
This fallback logic is incorrect as it ignores any RabbitConnectionDetails that may have been defined so, for example, a @ServiceConnection for Rabbit running in a container won't work correctly when using streams.
The auto-configuration for Rabbit Streams looks at the
spring.rabbit.stream.*properties for various settings, sometimes falling back to a more generalspring.rabbitproperty:spring-boot/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitStreamConfiguration.java
Lines 102 to 115 in 99142db
This fallback logic is incorrect as it ignores any
RabbitConnectionDetailsthat may have been defined so, for example, a@ServiceConnectionfor Rabbit running in a container won't work correctly when using streams.