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
package com.dy.pipIrrStatistics.util;
 
import com.dy.pipIrrGlobal.util.OrgListenerSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Component;
 
@Component
public class OrgListener extends OrgListenerSupport implements ApplicationListener<ApplicationReadyEvent> {
 
    @Autowired
    protected ResourceLoader resourceLoader ;
 
    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        try {
            //等1秒,等待com.alibaba.druid.pool.DruidDataSource实始化完成
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } finally {
            super.init(resourceLoader);
        }
    }
}