由于我的rabbitmq架设在测试服务期。
导致我本地测试的mq消息,经常被服务器消费掉。
所以通过添加v-host,可以创建专属v-host域下的消息进行生产和消费。
一 新增用户
点击Admin,点击右边Users

输入Username Password ,并且Tags给与Admin权限
二 创建 virtual host
点击virtual host,新增host

三 给vhost添加用户
我的vhost叫做local_test,在上图点击进入详情页
找到设置权限,User选择刚才的用户

以上就完成了rabbitmq的设置。
四 springboot和springMvc中的使用
springboot -- application.yml
spring:
    rabbitmq:
      host: xxxxx
      username: tyler    -- 新增的用户
      password: 123456
      virtual-host: local_test    -- 新增的vhost 
springmvc -- application.xml
<!-- 连接配置 -->
    <rabbit:connection-factory id="connectionFactory"
                               host="xxxx"
                               port="xxxx"
                               username="tyler"
                               password="123456"
                               virtual-host="local_test"
    /> 










