This yaml works
spring:
rabbitmq:
host: "[aaaa:bbbb:cccc::d]"
port: 5672
username: foo
password: "bar
but this yaml
spring:
rabbitmq:
addresses: "amqp://foo:bar@[aaaa:bbbb:cccc::d]:5672"
fails with
Failed to bind properties under 'spring.rabbitmq' to org.springframework.boot.autoconfigure.amqp.RabbitProperties:
Property: spring.rabbitmq.addresses
Value: amqp://foo:bar@[aaaa:bbbb:cccc::d]:5672
Origin: REDACTED
Reason: java.lang.NumberFormatException: For input string: "bbbb:cccc::d]:5672"
Comment From: bantu
This issue is somewhat similar to #6401 which concerns amqps
in spring.rabbitmq.addresses.
Comment From: bantu
https://github.com/rabbitmq/rabbitmq-java-client/issues/385 is also similar. Maybe this work can be reused somehow.
Comment From: philwebb
That NumberFormatException
is from our own parsing logic. I've refined parseHostAndPort
so that the last :
instead of the first one is used to locate the port number.
@bantu When the next CI build finishes (should be about an hour) could you give the latest SNAPSHOT a try to see if it solves it?
Comment From: bantu
@philwebb Thank you for the quick patch. Is there an easy way to use SNAPSHOT by altering my build.gradle
?
Comment From: snicoll
@bantu generate a sample project on start.spring.io with the Spring Boot version you want to test.
Comment From: bantu
@snicoll Excellent. Thanks.
@philwebb I can confirm that this works:
spring:
rabbitmq:
addresses: "amqp://foo:bar@[aaaa:bbbb:cccc::d]:5672"
as well as
spring:
rabbitmq:
addresses: "foo:bar@[aaaa:bbbb:cccc::d]:5672"
but omitting the port like
spring:
rabbitmq:
addresses: "foo:bar@[aaaa:bbbb:cccc::d]"
fails with java.lang.NumberFormatException: For input string: "d]"
. I am not sure whether that is a regression from your patch.