Spring Cloud Bus
rabbitmq客户端
1、pom引入
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-bus-amqp</artifactId> </dependency>
2、配置文件
spring: rabbitmq: host: rabbitmq port: 5672 username: user password: password
3、类文件使用
@RefreshScope 类文件注解
@Value("${wordConfig.word}") String word; //已注入方式获得值
其他写法:参见 https://segmentfault.com/a/1190000006226542