java-note/event at master · yulc-coding/java-note · GitHub
Skip to content

Latest commit

 

History

History

event

Folders and files

README.md

事件Event

详细介绍

Spring Boot 实现异步事件Event

定义事件类

继承 ApplicationEvent

定义监听类

实现 ApplicationListener

发送事件

ApplicationEventPublisher.publishEvent()

实现异步

  • @EnableAsync 启用Spring的异步方法执行功能
  • @Async 当前方法使用异步

自定义异步线程池