From 6f39976dff74e48f314b607c714bfb72a5f46e4a Mon Sep 17 00:00:00 2001 From: zzh <2441574824@qq.com> Date: Mon, 29 Jul 2024 17:18:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 35 +++++++++++++++++++ pom.xml | 34 ++++++++++++++++++ .../com/bwie/common/rabbit/RabbitConfig.java | 30 ++++++++++++++++ ...ot.autoconfigure.AutoConfiguration.imports | 1 + 4 files changed, 100 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/main/java/com/bwie/common/rabbit/RabbitConfig.java create mode 100644 src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3e403e3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..14e878b --- /dev/null +++ b/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + + com.bwie + cloud-common-rabbit + 1.0-SNAPSHOT + + + com.muyu + cloud-common + 3.6.3 + + + + 17 + 17 + UTF-8 + + + + + com.muyu + cloud-common-core + + + org.springframework.boot + spring-boot-starter-amqp + + + + diff --git a/src/main/java/com/bwie/common/rabbit/RabbitConfig.java b/src/main/java/com/bwie/common/rabbit/RabbitConfig.java new file mode 100644 index 0000000..709f307 --- /dev/null +++ b/src/main/java/com/bwie/common/rabbit/RabbitConfig.java @@ -0,0 +1,30 @@ +package com.bwie.common.rabbit; + +import jakarta.annotation.PostConstruct; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.amqp.core.AmqpAdmin; +import org.springframework.amqp.core.AmqpTemplate; +import org.springframework.context.annotation.Configuration; + +/** + * @Author:zhangzhihao + * @name:RabbitConfig + * @Date:2024/7/29 16:53 + * 不准抄代码,添加注释,清楚每一行代码意思 + */ +@Log4j2 +@Configuration +@AllArgsConstructor +public class RabbitConfig { + private final AmqpAdmin amqpAdmin; + private final AmqpTemplate amqpTemplate; + + @PostConstruct + public void init(){ + log.info("RabbitMq启动成功"); + } + + + +} diff --git a/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..f9b6116 --- /dev/null +++ b/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.bwie.common.rabbit.RabbitConfig