package com.gkhy.hazmat.common.listener; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; import org.springframework.stereotype.Component; @Component @Slf4j public class CustomEventPublisher { @Autowired private ApplicationEventPublisher publisher; public void publishEntry(Long entryRecordId,String codePrex,Long companyId,Long userId){ EntryEvent entryEvent=new EntryEvent(this,entryRecordId,codePrex,companyId,userId); publisher.publishEvent(entryEvent); log.info("事件发布成功:entryRecordId={},codePrex={},companyId={},userId={}",entryRecordId,codePrex,companyId,userId); } }