Browse Source

Merge branch '2.4.x' into 2.5.x

Closes gh-28134
pull/28204/head
Phillip Webb 4 years ago
parent
commit
fcb6f557f7
  1. 4
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java
  2. 9
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitPropertiesTests.java

4
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -1111,7 +1111,7 @@ public class RabbitProperties { @@ -1111,7 +1111,7 @@ public class RabbitProperties {
}
private void parseHostAndPort(String input, boolean sslEnabled) {
int portIndex = input.indexOf(':');
int portIndex = input.lastIndexOf(':');
if (portIndex == -1) {
this.host = input;
this.port = (determineSslEnabled(sslEnabled)) ? DEFAULT_PORT_SECURE : DEFAULT_PORT;

9
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitPropertiesTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -240,6 +240,13 @@ class RabbitPropertiesTests { @@ -240,6 +240,13 @@ class RabbitPropertiesTests {
.isEqualTo("user:secret@rabbit1.example.com:1234/alpha,rabbit2.example.com");
}
@Test
void ipv6Address() {
this.properties.setAddresses("amqp://foo:bar@[aaaa:bbbb:cccc::d]:5672");
assertThat(this.properties.determineHost()).isEqualTo("[aaaa:bbbb:cccc::d]");
assertThat(this.properties.determinePort()).isEqualTo(5672);
}
@Test
void determineAddressesReturnsAddressesWithJustHostAndPort() {
this.properties.setAddresses("user:secret@rabbit1.example.com:1234/alpha,rabbit2.example.com");

Loading…
Cancel
Save