springboot整合rabbitMQ

1. 打开idea,”file“ -> "new" -> "module" -> "spring initilizer" ····->"web" ->"spring web"

2. 搭建依赖

   修改pom.xml 配置文件,加入依赖项。

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-amqp</artifactId>
</dependency>

  如果pom.xml文件没有变成蓝色的m,则右键,”add as Maven Project“。

3. 写配置文件,在src -> main -> resources  打开application.yml文件

spring:
  application:
    name:rabbitmq-springboot
  rabbitmq:
    host: localhost
    port: 5672
    username: guest
    password: guest
    virtual-host: /

 4. 在main -> java ->com.example 创建 hello.HelloCustomer.class

 

posted @ 2020-09-23 00:21  tianyee  阅读(117)  评论(0编辑  收藏  举报