package com.zy.asrs.wms.common.event; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; //实现ApplicationListener接口,并指定监听的事件类型 @Component public class OrderBatchListener implements ApplicationListener { @Override public void onApplicationEvent(OrderBatchEvent event) { //使用onApplicationEvent方法对消息进行接受处理 String orderId = event.getOrderId(); System.out.println("DemoListener获取到了监听消息:" + orderId); } }