admin
2020-09-02 ab141df783309d4a704f7b7d20aa465bf42ed371
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.yeshi.buwan.util;
 
import com.yeshi.buwan.funtv.FunTVUtil;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
 
/**
 * ÏµÍ³³õʼ»¯
 *
 * @author Administrator
 */
@Component
public class SpringContext implements ApplicationListener<ContextRefreshedEvent> {
    @Resource
    private FunTVUtil funTVUtil;
 
    private static boolean isInited = false;
 
    public void onApplicationEvent(ContextRefreshedEvent arg0) {
        if (arg0.getApplicationContext().getParent() != null) {
            System.out.println(System.currentTimeMillis());
            onApplication(arg0);
        }
    }
 
    private synchronized void onApplication(ContextRefreshedEvent context) {
        if (!isInited) {
            isInited = true;
            System.out.println("ϵͳ³õʼ»¯³É¹¦");
            init();
        }
    }
 
    private void init(){
//        funTVUtil.startParseShortVideo();
    }
 
}