eight
2024-08-21 3c2ee852994cc3c4d861484f12d972b42cb0ffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package cn.lihu.jh.module.ecg.listener;
 
import cn.lihu.jh.module.ecg.service.queue.QueueService;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
 
@Component
public class MySpringEventListener {
 
    @Resource
    private QueueService queueService;
 
    @EventListener
    public void onApplicationEvent(ApplicationStartedEvent event) {
        System.out.println("应用启动完成,通知监听器执行缓存预加载操作");
        queueService.initQueue();
        queueService.hurryup();
    }
}