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