package com.iamberry.answer.service.start;
import java.util.concurrent.CountDownLatch;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.support.AbstractApplicationContext;

@ImportResource("classpath:iamberry-answer-service-spring.xml")
@SpringBootApplication
public class InitApp {
    @Bean
    public CountDownLatch closeLatch() {
        return new CountDownLatch(1);
    }
	public static void main(String[] args) throws Exception {
		AbstractApplicationContext ctx = (AbstractApplicationContext) new SpringApplicationBuilder().sources(InitApp.class).web(false).run(args);
		CountDownLatch closeLatch = ctx.getBean(CountDownLatch.class);
		closeLatch.await();
	}
}
