From e5169fb2a0944f04c95fbc75cdcc1240c37853fe Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Fri, 14 Jul 2023 15:40:10 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=908.0=E3=80=91=E3=80=90event=E3=80=91?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96event=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel-d-event/README.md | 1 + kernel-d-event/event-api/README.md | 1 + kernel-d-event/event-api/pom.xml | 37 ++++++ .../api/annotation/BusinessListener.java | 50 ++++++++ .../event/api/constants/EventConstants.java | 45 ++++++++ .../kernel/event/api/enums/DemoEnum.java | 33 ++++++ .../event/api/exception/EventException.java | 48 ++++++++ .../exception/enums/EventExceptionEnum.java | 61 ++++++++++ kernel-d-event/event-sdk/README.md | 1 + kernel-d-event/event-sdk/pom.xml | 29 +++++ .../event/sdk/EventAnnotationScanner.java | 107 ++++++++++++++++++ .../event/sdk/container/EventContainer.java | 44 +++++++ .../sdk/pojo/BusinessListenerDetail.java | 26 +++++ .../sdk/publish/BusinessEventPublisher.java | 42 +++++++ .../event-spring-boot-starter/README.md | 2 + .../event-spring-boot-starter/pom.xml | 29 +++++ .../event/starter/EventAutoConfiguration.java | 38 +++++++ .../main/resources/META-INF/spring.factories | 2 + kernel-d-event/pom.xml | 35 ++++++ pom.xml | 3 + 20 files changed, 634 insertions(+) create mode 100644 kernel-d-event/README.md create mode 100644 kernel-d-event/event-api/README.md create mode 100644 kernel-d-event/event-api/pom.xml create mode 100644 kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/annotation/BusinessListener.java create mode 100644 kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/constants/EventConstants.java create mode 100644 kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/enums/DemoEnum.java create mode 100644 kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/exception/EventException.java create mode 100644 kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/exception/enums/EventExceptionEnum.java create mode 100644 kernel-d-event/event-sdk/README.md create mode 100644 kernel-d-event/event-sdk/pom.xml create mode 100644 kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/EventAnnotationScanner.java create mode 100644 kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/container/EventContainer.java create mode 100644 kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/pojo/BusinessListenerDetail.java create mode 100644 kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/publish/BusinessEventPublisher.java create mode 100644 kernel-d-event/event-spring-boot-starter/README.md create mode 100644 kernel-d-event/event-spring-boot-starter/pom.xml create mode 100644 kernel-d-event/event-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/event/starter/EventAutoConfiguration.java create mode 100644 kernel-d-event/event-spring-boot-starter/src/main/resources/META-INF/spring.factories create mode 100644 kernel-d-event/pom.xml diff --git a/kernel-d-event/README.md b/kernel-d-event/README.md new file mode 100644 index 000000000..608b94e34 --- /dev/null +++ b/kernel-d-event/README.md @@ -0,0 +1 @@ +# 业务事件 \ No newline at end of file diff --git a/kernel-d-event/event-api/README.md b/kernel-d-event/event-api/README.md new file mode 100644 index 000000000..27e91dc89 --- /dev/null +++ b/kernel-d-event/event-api/README.md @@ -0,0 +1 @@ +# api模块,存放接口、常量、异常、枚举等模块规则相关类 \ No newline at end of file diff --git a/kernel-d-event/event-api/pom.xml b/kernel-d-event/event-api/pom.xml new file mode 100644 index 000000000..bf31650d5 --- /dev/null +++ b/kernel-d-event/event-api/pom.xml @@ -0,0 +1,37 @@ + + + 4.0.0 + + + cn.stylefeng.roses + kernel-d-event + 8.0.0 + ../pom.xml + + + event-api + + jar + + + + + + cn.stylefeng.roses + config-api + ${roses.version} + + + + + + cn.stylefeng.roses + validator-api + ${roses.version} + + + + + diff --git a/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/annotation/BusinessListener.java b/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/annotation/BusinessListener.java new file mode 100644 index 000000000..696222bcf --- /dev/null +++ b/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/annotation/BusinessListener.java @@ -0,0 +1,50 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.event.api.annotation; + +import java.lang.annotation.*; + +/** + * 业务事件监听的注解 + * + * @author fengshuonan + * @since 2023/7/14 15:12 + */ +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface BusinessListener { + + /** + * 监听业务的编码或者标识 + */ + String businessCode() default ""; + + /** + * 业务数据的参数类型 + */ + Class clazz(); + +} diff --git a/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/constants/EventConstants.java b/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/constants/EventConstants.java new file mode 100644 index 000000000..f2408ec4b --- /dev/null +++ b/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/constants/EventConstants.java @@ -0,0 +1,45 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.event.api.constants; + +/** + * 业务事件业务 + * + * @author fengshuonan + * @date 2023-07-14 15:05:54 + */ +public interface EventConstants { + + /** + * 业务事件模块名称 + */ + String EVENT_MODULE_NAME = "kernel-s-event"; + + /** + * 异常枚举的步进值 + */ + String EVENT_EXCEPTION_STEP_CODE = "99"; + +} diff --git a/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/enums/DemoEnum.java b/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/enums/DemoEnum.java new file mode 100644 index 000000000..3d432eb1b --- /dev/null +++ b/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/enums/DemoEnum.java @@ -0,0 +1,33 @@ +package cn.stylefeng.roses.kernel.event.api.enums; + +import lombok.Getter; + +/** + * 一个示例 + * + * @author fengshuonan + * @date 2023-07-14 15:05:54 + */ +@Getter +public enum DemoEnum { + + /** + * markdown格式 + */ + MARKDOWN(1, "markdown格式"), + + /** + * 富文本格式 + */ + TEXT(2, "富文本格式"); + + private final Integer code; + + private final String message; + + DemoEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + +} diff --git a/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/exception/EventException.java b/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/exception/EventException.java new file mode 100644 index 000000000..4b49f013b --- /dev/null +++ b/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/exception/EventException.java @@ -0,0 +1,48 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.event.api.exception; + +import cn.hutool.core.util.StrUtil; +import cn.stylefeng.roses.kernel.event.api.constants.EventConstants; +import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum; +import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException; + +/** + * 业务事件异常 + * + * @author fengshuonan + * @date 2023-07-14 15:05:54 + */ +public class EventException extends ServiceException { + + public EventException(AbstractExceptionEnum exception, Object... params) { + super(EventConstants.EVENT_MODULE_NAME, exception.getErrorCode(), StrUtil.format(exception.getUserTip(), params)); + } + + public EventException(AbstractExceptionEnum exception) { + super(EventConstants.EVENT_MODULE_NAME, exception); + } + +} diff --git a/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/exception/enums/EventExceptionEnum.java b/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/exception/enums/EventExceptionEnum.java new file mode 100644 index 000000000..d2bc6fe5a --- /dev/null +++ b/kernel-d-event/event-api/src/main/java/cn/stylefeng/roses/kernel/event/api/exception/enums/EventExceptionEnum.java @@ -0,0 +1,61 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.event.api.exception.enums; + +import cn.stylefeng.roses.kernel.event.api.constants.EventConstants; +import cn.stylefeng.roses.kernel.rule.constants.RuleConstants; +import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum; +import lombok.Getter; + +/** + * 业务事件的异常枚举 + * + * @author fengshuonan + * @date 2023-07-14 15:05:54 + */ +@Getter +public enum EventExceptionEnum implements AbstractExceptionEnum { + + /** + * 查询不到对应业务事件 + */ + CANT_FIND_EVENT(RuleConstants.BUSINESS_ERROR_TYPE_CODE + EventConstants.EVENT_EXCEPTION_STEP_CODE + "01", "查询不到对应业务事件,具体信息:{}"); + + /** + * 错误编码 + */ + private final String errorCode; + + /** + * 提示用户信息 + */ + private final String userTip; + + EventExceptionEnum(String errorCode, String userTip) { + this.errorCode = errorCode; + this.userTip = userTip; + } + +} diff --git a/kernel-d-event/event-sdk/README.md b/kernel-d-event/event-sdk/README.md new file mode 100644 index 000000000..ebd748f4f --- /dev/null +++ b/kernel-d-event/event-sdk/README.md @@ -0,0 +1 @@ +# SDK模块,存放一些本模块通用的工具处理类等 \ No newline at end of file diff --git a/kernel-d-event/event-sdk/pom.xml b/kernel-d-event/event-sdk/pom.xml new file mode 100644 index 000000000..25c3c5576 --- /dev/null +++ b/kernel-d-event/event-sdk/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + + + cn.stylefeng.roses + kernel-d-event + 8.0.0 + ../pom.xml + + + event-sdk + + jar + + + + + + cn.stylefeng.roses + event-api + ${roses.version} + + + + + diff --git a/kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/EventAnnotationScanner.java b/kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/EventAnnotationScanner.java new file mode 100644 index 000000000..6ab7e368b --- /dev/null +++ b/kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/EventAnnotationScanner.java @@ -0,0 +1,107 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.event.sdk; + +import cn.stylefeng.roses.kernel.event.api.annotation.BusinessListener; +import cn.stylefeng.roses.kernel.event.sdk.pojo.BusinessListenerDetail; +import cn.stylefeng.roses.kernel.rule.util.AopTargetUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; + +import java.lang.reflect.Method; +import java.util.ArrayList; + +/** + * 扫描所有的业务监听事件,最终汇总到Event容器中 + * + * @author fengshuonan + * @since 2023/7/14 15:09 + */ +@Slf4j +public class EventAnnotationScanner implements BeanPostProcessor { + + @Override + public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { + return bean; + } + + @Override + public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { + + // 如果controller是代理对象,则需要获取原始类的信息 + Object aopTarget = AopTargetUtils.getTarget(bean); + + if (aopTarget == null) { + aopTarget = bean; + } + + Class clazz = aopTarget.getClass(); + + // 判断类中是否有@BusinessListener注解 + this.doScan(clazz, beanName); + + return bean; + } + + /** + * 扫描整个类中包含的所有@BusinessListener注解 + * + * @author fengshuonan + * @since 2023/7/14 15:24 + */ + private void doScan(Class clazz, String beanName) { + + ArrayList businessListenerDetails = new ArrayList<>(); + + Method[] declaredMethods = clazz.getDeclaredMethods(); + for (Method declaredMethod : declaredMethods) { + BusinessListener businessListener = declaredMethod.getAnnotation(BusinessListener.class); + + if (businessListener != null) { + BusinessListenerDetail businessListenerDetail = createDefinition(beanName, declaredMethod, businessListener); + + if (businessListenerDetail != null) { + businessListenerDetails.add(businessListenerDetail); + } + + log.debug("扫描到资源: " + businessListenerDetail); + } + } + } + + /** + * 讲扫描到的注解信息的调用信息,封装到BusinessListenerDetail + * + * @author fengshuonan + * @since 2023/7/14 15:27 + */ + private BusinessListenerDetail createDefinition(String beanName, Method method, BusinessListener businessListener) { + + + return new BusinessListenerDetail(); + } + +} diff --git a/kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/container/EventContainer.java b/kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/container/EventContainer.java new file mode 100644 index 000000000..50862057f --- /dev/null +++ b/kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/container/EventContainer.java @@ -0,0 +1,44 @@ +package cn.stylefeng.roses.kernel.event.sdk.container; + +import cn.stylefeng.roses.kernel.event.sdk.pojo.BusinessListenerDetail; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 事件的容器 + * + * @author fengshuonan + * @since 2023/7/14 15:08 + */ +public class EventContainer { + + /** + * key是业务的标识,例如:ORG_ADD + *

+ * value是对应监听这个事件的所有方法信息 + */ + private static final Map> CONTEXT = new HashMap<>(); + + /** + * 获取业务对应的所有监听器 + * + * @author fengshuonan + * @since 2023/7/14 15:21 + */ + public static List getListener(String businessCode) { + return CONTEXT.get(businessCode); + } + + /** + * 添加到容器中业务监听器信息 + * + * @author fengshuonan + * @since 2023/7/14 15:22 + */ + public static void addListenerList(String businessCode, List businessListenerItemList) { + CONTEXT.put(businessCode, businessListenerItemList); + } + +} diff --git a/kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/pojo/BusinessListenerDetail.java b/kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/pojo/BusinessListenerDetail.java new file mode 100644 index 000000000..afb3a3ae3 --- /dev/null +++ b/kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/pojo/BusinessListenerDetail.java @@ -0,0 +1,26 @@ +package cn.stylefeng.roses.kernel.event.sdk.pojo; + +import lombok.Data; + +import java.lang.reflect.Method; + +/** + * 业务事件监听的详情封装 + * + * @author fengshuonan + * @since 2023/7/14 15:18 + */ +@Data +public class BusinessListenerDetail { + + /** + * Spring的Bean名称 + */ + private String beanName; + + /** + * 业务监听器对应注解的类方法 + */ + private Method listenerMethod; + +} diff --git a/kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/publish/BusinessEventPublisher.java b/kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/publish/BusinessEventPublisher.java new file mode 100644 index 000000000..18ed0c47b --- /dev/null +++ b/kernel-d-event/event-sdk/src/main/java/cn/stylefeng/roses/kernel/event/sdk/publish/BusinessEventPublisher.java @@ -0,0 +1,42 @@ +package cn.stylefeng.roses.kernel.event.sdk.publish; + +import cn.hutool.extra.spring.SpringUtil; +import cn.stylefeng.roses.kernel.event.sdk.container.EventContainer; +import cn.stylefeng.roses.kernel.event.sdk.pojo.BusinessListenerDetail; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; + +public class BusinessEventPublisher { + + /** + * 发布一个业务事件 + * + * @author fengshuonan + * @since 2023/7/14 15:37 + */ + public static void publishEvent(String businessCode, T businessObject) { + + List listener = EventContainer.getListener(businessCode); + + for (BusinessListenerDetail businessListenerDetail : listener) { + + String beanName = businessListenerDetail.getBeanName(); + + Method listenerMethod = businessListenerDetail.getListenerMethod(); + + Object bean = SpringUtil.getBean(beanName); + + try { + listenerMethod.invoke(bean, businessObject); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + + } + + + } + +} diff --git a/kernel-d-event/event-spring-boot-starter/README.md b/kernel-d-event/event-spring-boot-starter/README.md new file mode 100644 index 000000000..ab408c724 --- /dev/null +++ b/kernel-d-event/event-spring-boot-starter/README.md @@ -0,0 +1,2 @@ +# Spring Boot自动装配 + diff --git a/kernel-d-event/event-spring-boot-starter/pom.xml b/kernel-d-event/event-spring-boot-starter/pom.xml new file mode 100644 index 000000000..942c5d531 --- /dev/null +++ b/kernel-d-event/event-spring-boot-starter/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + + + cn.stylefeng.roses + kernel-d-event + 8.0.0 + ../pom.xml + + + event-spring-boot-starter + + jar + + + + + + cn.stylefeng.roses + event-sdk + ${roses.version} + + + + + diff --git a/kernel-d-event/event-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/event/starter/EventAutoConfiguration.java b/kernel-d-event/event-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/event/starter/EventAutoConfiguration.java new file mode 100644 index 000000000..23ccdf876 --- /dev/null +++ b/kernel-d-event/event-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/event/starter/EventAutoConfiguration.java @@ -0,0 +1,38 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.event.starter; + +import org.springframework.context.annotation.Configuration; + +/** + * 业务事件自动装配 + * + * @author fengshuonan + * @date 2023-07-14 15:05:54 + */ +@Configuration +public class EventAutoConfiguration { + +} diff --git a/kernel-d-event/event-spring-boot-starter/src/main/resources/META-INF/spring.factories b/kernel-d-event/event-spring-boot-starter/src/main/resources/META-INF/spring.factories new file mode 100644 index 000000000..8ad7fffea --- /dev/null +++ b/kernel-d-event/event-spring-boot-starter/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ + cn.stylefeng.roses.kernel.event.starter.EventAutoConfiguration diff --git a/kernel-d-event/pom.xml b/kernel-d-event/pom.xml new file mode 100644 index 000000000..d6bcf8d34 --- /dev/null +++ b/kernel-d-event/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + cn.stylefeng.roses + roses-kernel + 8.0.0 + ../pom.xml + + + kernel-d-event + + pom + + + event-api + event-sdk + event-spring-boot-starter + + + + + + + cn.stylefeng.roses + kernel-a-rule + ${roses.version} + + + + + diff --git a/pom.xml b/pom.xml index 6e626183a..8556e9e0e 100644 --- a/pom.xml +++ b/pom.xml @@ -40,6 +40,9 @@ kernel-d-email + + kernel-d-event + kernel-d-file