Skip to content

Commit 7593aab

Browse files
committed
Fix comments
1 parent f513d45 commit 7593aab

File tree

4 files changed

+59
-4
lines changed

4 files changed

+59
-4
lines changed

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

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,18 @@ static EnvironmentBuilder configure(EnvironmentBuilder builder, RabbitProperties
113113
PropertyMapper map = PropertyMapper.get();
114114
map.from(connectionDetails.getHost()).to(builder::host);
115115
map.from(connectionDetails.getPort()).to(builder::port);
116-
map.from(stream.getVirtualHost())
116+
map.from(connectionDetails.getVirtualHost())
117117
.as(withFallback(properties::getVirtualHost))
118118
.whenNonNull()
119119
.to(builder::virtualHost);
120-
map.from(stream.getUsername()).as(withFallback(properties::getUsername)).whenNonNull().to(builder::username);
121-
map.from(stream.getPassword()).as(withFallback(properties::getPassword)).whenNonNull().to(builder::password);
120+
map.from(connectionDetails.getUsername())
121+
.as(withFallback(properties::getUsername))
122+
.whenNonNull()
123+
.to(builder::username);
124+
map.from(connectionDetails.getPassword())
125+
.as(withFallback(properties::getPassword))
126+
.whenNonNull()
127+
.to(builder::password);
122128
return builder;
123129
}
124130

@@ -144,6 +150,21 @@ public int getPort() {
144150
return this.streamProperties.getPort();
145151
}
146152

153+
@Override
154+
public String getVirtualHost() {
155+
return this.streamProperties.getVirtualHost();
156+
}
157+
158+
@Override
159+
public String getUsername() {
160+
return this.streamProperties.getUsername();
161+
}
162+
163+
@Override
164+
public String getPassword() {
165+
return this.streamProperties.getPassword();
166+
}
167+
147168
}
148169

149170
}

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,28 @@ public interface RabbitStreamConnectionDetails extends ConnectionDetails {
3838
*/
3939
int getPort();
4040

41+
/**
42+
* Login user to authenticate to the broker.
43+
* @return the login user to authenticate to the broker or {@code null}
44+
*/
45+
default String getUsername() {
46+
return null;
47+
}
48+
49+
/**
50+
* Login to authenticate against the broker.
51+
* @return the login to authenticate against the broker or {@code null}
52+
*/
53+
default String getPassword() {
54+
return null;
55+
}
56+
57+
/**
58+
* Virtual host to use when connecting to the broker.
59+
* @return the virtual host to use when connecting to the broker or {@code null}
60+
*/
61+
default String getVirtualHost() {
62+
return null;
63+
}
64+
4165
}

spring-boot-project/spring-boot-testcontainers/src/dockerTest/java/org/springframework/boot/testcontainers/service/connection/amqp/RabbitStreamContainerConnectionDetailsFactoryIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class RabbitStreamContainerConnectionDetailsFactoryIntegrationTests {
6666
private static RabbitMQContainer getRabbitMqStreamContainer() {
6767
RabbitMQContainer container = TestImage.container(RabbitMQContainer.class);
6868
container.addExposedPorts(RABBITMQ_STREAMS_PORT);
69-
var enabledPlugins = "[rabbitmq_stream,rabbitmq_prometheus].";
69+
String enabledPlugins = "[rabbitmq_stream,rabbitmq_prometheus].";
7070
container.withCopyToContainer(Transferable.of(enabledPlugins), "/etc/rabbitmq/enabled_plugins");
7171
return container;
7272
}

spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/amqp/RabbitStreamContainerConnectionDetailsFactory.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ public int getPort() {
6464
return getContainer().getMappedPort(5552);
6565
}
6666

67+
@Override
68+
public String getUsername() {
69+
return getContainer().getAdminUsername();
70+
}
71+
72+
@Override
73+
public String getPassword() {
74+
return getContainer().getAdminPassword();
75+
}
76+
6777
}
6878

6979
}

0 commit comments

Comments
 (0)