package org.holer.server;


import org.holer.server.constant.ServerConst;
import org.holer.server.container.ServerContainer;
import org.holer.server.util.ServerUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;

@EnableScheduling
@SpringBootApplication
public class HolerApp {
    private static final Logger log = LoggerFactory.getLogger(HolerApp.class);

    public static void main(String[] args) {
        ConfigurableApplicationContext configurableApplicationContext = SpringApplication.run(HolerApp.class, args);
        ServerUtil.setAppCtx(configurableApplicationContext);
        String serverPort = ServerUtil.property(ServerConst.SERVER_PORT);
        log.info("started on port " + serverPort);
        ServerContainer.getContainer().start();
    }
}