| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | import com.yeshi.buwan.funtv.FunTVUtil; |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import io.seata.rm.datasource.DataSourceProxy; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.context.annotation.Bean; |
| | | 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; |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(SpringContext.class); |
| | | |
| | | public void onApplicationEvent(ContextRefreshedEvent arg0) { |
| | | if (arg0.getApplicationContext().getParent() != null) { |
| | |
| | | } |
| | | } |
| | | |
| | | @Bean |
| | | public DataSourceProxy dataSourceProxy(DruidDataSource druidDataSource) { |
| | | return new DataSourceProxy(druidDataSource); |
| | | } |
| | | |
| | | |
| | | private synchronized void onApplication(ContextRefreshedEvent context) { |
| | | if (!isInited) { |
| | | isInited = true; |
| | | System.out.println("系统初始化成功"); |
| | | System.out.println("系统初始化成功"); |
| | | init(); |
| | | } |
| | | } |
| | | |
| | | private void init(){ |
| | | // funTVUtil.startParseShortVideo(); |
| | | private void init() { |
| | | logger.error("初始化"); |
| | | } |
| | | |
| | | |
| | | } |