从 spring boot application.properties 文件访问 amqp_URI

解码器

我有如下 amqp_URI

amqp://sds:%23%23%45%56%65%56%56%@myserver:5672 

我需要从 Spring 引导application.properties文件访问此服务器我试过spring.rabbitmq.addresses财产。但没有运气。

任何抬头将不胜感激

尼拉吉·本杰瓦尔

您可以在 application.properties 中使用以下属性 -

spring.rabbitmq.host=
spring.rabbitmq.virtual-host= <if you are using root (/) remove this property>
spring.rabbitmq.port=
spring.rabbitmq.username=
spring.rabbitmq.password=

要收听队列(例如:test-queue),您可以使用以下代码 -

@Component
public class TestConsumer {
    @RabbitListener(queues = 'test-queue')
    public void onMessage(Message message) {
      //TODO
    }
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在Spring Boot中访问application.properties文件中定义的值

如何在Spring Boot中访问application.properties文件中定义的内容?

Spring Boot jar中的application.properties文件在哪里?

如何使用主要方法访问Spring Boot应用程序中application.properties文件中的值

在Spring Boot中将spring.application.json用于application.properties文件

在Spring Boot中将application.properties文件加载到java.util.Properties

Intelij Spring Boot 2 application.properties

Spring Boot 从 application.properties 读取值

Spring Boot邮件忽略application.properties

访问Tomcat中用于Spring Boot应用程序的externalize application.properties?

使用 webpack devserver 时访问 Thymeleaf Spring Boot application.properties

在外部Spring Boot Java Project中访问属性pf application.properties

Spring Boot的application.yml和application.properties

spring-boot 配置文件:resources/profiles/application-*.properties

运行测试时如何指示Spring Boot在测试资源中使用application.properties文件

如何在Spring Boot中的application.properties中指定外部属性文件?

如何将Spring Boot中的application.properties文件外部化为例如外部依赖的JAR?

如何在Spring Boot应用程序的application.properties文件中设置MyBatis配置属性?

如何将Spring Boot中的URL外部化为application.properties文件?

如何在spring-boot中添加多个application.properties文件?

如何在我的application.properties文件的Spring Boot应用程序中配置HikariCP?

合并许多application.properties文件,而不是在Spring Boot上替换?

如何将Spring Boot application.properties外部化为tomcat / lib文件夹

具有application.properties的spring-boot数据源配置文件

Spring Boot application.properties扩展了另一个属性文件

使用Spring Boot在运行时以编程方式更改application.properties文件

在Spring Boot application.properties/.yml中基于OS设置日志文件位置

Spring Boot-用于定义HTTP请求的baseUrl的配置文件(application.properties)

使用特定的application.properties文件将Spring Boot应用程序部署到Heroku