无法更改rabbitmq默认用户

问题描述 投票:0回答:2

我正在尝试从带有一个新创建的用户的springbok应用程序连接到rabbitmq,但是根据日志,应用程序总是尝试连接默认的访客用户

rabbitmq日志

2019-02-13 00:12:38.860 [error] <0.1318.0> Error on AMQP connection <0.1318.0> (192.168.1.185:60124 -> 192.168.1.185:5672, state: starting):
PLAIN login refused: user 'guest' can only connect via localhost

yaml spring boot app config

spring:
  rabbitmq:
    host: 111.111.111.111
    port: 5672
    username: user1
    password: user1
    connectionName: com.test.user

spring boot错误日志

Caused by: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
    at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:362)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1104)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1054)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1218)
    at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:471)
    ... 10 common frames omitted
spring-boot security rabbitmq
2个回答
0
投票

在springboot应用程序中,在资源下,您可以创建一个application.properties文件并配置以下信息。

spring.rabbitmq.host=111.111.111.111
spring.rabbitmq.port=5672
spring.rabbitmq.username=user1
spring.rabbitmq.password=user1

0
投票

你可以这样写:

rabbitmq:
   config:
      host: 111.111.111.111
      port: 5672
      username: user1
      password: user1
      connectionName: com.test.user
© www.soinside.com 2019 - 2024. All rights reserved.