SpringBoot的事件監聽

SpringBoot的事件監聽 事件監聽的流程分爲三步: 1、自定義事件,一般是繼承ApplicationEvent抽象類。 2、定義事件監聽器,一般是實現ApplicationListener接口。 3、a、啓動的時候,需要將監聽器加入到Spring容器中。    b、或者將監聽器加入到容器中。@Component    c、使用@EventListener註解,在方法上面加入@EventLis
相關文章
相關標籤/搜索