package com.yihu.hos.arbiter.listener;

import com.yihu.hos.arbiter.services.ArbiterServerService;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@Component
public class ApplicationStartListener implements ApplicationListener<ContextRefreshedEvent> {
    private static Logger logger = LogManager.getLogger(ApplicationStartListener.class);

    @Autowired
    private ArbiterServerService arbiterServerService;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        arbiterServerStart();
    }


    public void arbiterServerStart() {
        arbiterServerService.start();   //后期可以统一到Router上来处理
    }
}