Merge pull request #6863 from altfatterz:default-credentials-rabbitmq
* pr/6863: Polish "Expose default RabbitMQ credentials in the metadata" Expose default RabbitMQ credentials in the metadata
This commit is contained in:
commit
132467787c
|
|
@ -54,12 +54,12 @@ public class RabbitProperties {
|
|||
/**
|
||||
* Login user to authenticate to the broker.
|
||||
*/
|
||||
private String username;
|
||||
private String username = "guest";
|
||||
|
||||
/**
|
||||
* Login to authenticate against the broker.
|
||||
*/
|
||||
private String password;
|
||||
private String password = "guest";
|
||||
|
||||
/**
|
||||
* SSL configuration.
|
||||
|
|
|
|||
|
|
@ -116,6 +116,20 @@ public class RabbitAutoConfigurationTests {
|
|||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultConnectionFactoryConfiguration() {
|
||||
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
||||
.run((context) -> {
|
||||
RabbitProperties properties = new RabbitProperties();
|
||||
com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(
|
||||
context);
|
||||
assertThat(rabbitConnectionFactory.getUsername())
|
||||
.isEqualTo(properties.getUsername());
|
||||
assertThat(rabbitConnectionFactory.getPassword())
|
||||
.isEqualTo(properties.getPassword());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConnectionFactoryWithOverrides() {
|
||||
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@ public class RabbitPropertiesTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void usernameDefaultsToNull() {
|
||||
assertThat(this.properties.getUsername()).isNull();
|
||||
public void usernameDefaultsToGuest() {
|
||||
assertThat(this.properties.getUsername()).isEqualTo("guest");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -166,8 +166,8 @@ public class RabbitPropertiesTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void passwordDefaultsToNull() {
|
||||
assertThat(this.properties.getPassword()).isNull();
|
||||
public void passwordDefaultsToGuest() {
|
||||
assertThat(this.properties.getPassword()).isEqualTo("guest");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1045,7 +1045,7 @@ content into your application. Rather, pick only the properties that you need.
|
|||
spring.rabbitmq.listener.simple.retry.stateless=true # Whether or not retry is stateless or stateful.
|
||||
spring.rabbitmq.listener.simple.transaction-size= # Number of messages to be processed in a transaction. That is, the number of messages between acks. For best results, it should be less than or equal to the prefetch count.
|
||||
spring.rabbitmq.listener.type=simple # Listener container type.
|
||||
spring.rabbitmq.password= # Login to authenticate against the broker.
|
||||
spring.rabbitmq.password=guest # Login to authenticate against the broker.
|
||||
spring.rabbitmq.port=5672 # RabbitMQ port.
|
||||
spring.rabbitmq.publisher-confirms=false # Whether to enable publisher confirms.
|
||||
spring.rabbitmq.publisher-returns=false # Whether to enable publisher returns.
|
||||
|
|
@ -1068,7 +1068,7 @@ content into your application. Rather, pick only the properties that you need.
|
|||
spring.rabbitmq.template.retry.max-interval=10000 # Maximum number of attempts to publish a message.
|
||||
spring.rabbitmq.template.retry.multiplier=1.0 # Multiplier to apply to the previous publishing retry interval.
|
||||
spring.rabbitmq.template.routing-key= # Value of a default routing key to use for send operations.
|
||||
spring.rabbitmq.username= # Login user to authenticate to the broker.
|
||||
spring.rabbitmq.username=guest # Login user to authenticate to the broker.
|
||||
spring.rabbitmq.virtual-host= # Virtual host to use when connecting to the broker.
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue