package com.iamberry.app.start;
import java.util.List;
import java.util.concurrent.CountDownLatch;

import org.apache.commons.lang3.StringUtils;
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;

import com.iamberry.app.core.entity.User;
import com.iamberry.app.face.UserService;
import com.iamberry.app.mapper.UserMapper;
import com.iamberry.app.service.MilkServiceImpl;
import com.iamberry.app.ulitity.Utility;

@ImportResource("classpath:iamberry-app-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);
		
		System.out.println(ctx.getBean(MilkServiceImpl.class).getMilkRecordByDate("0020002518fe34d45136", "2016"));
		
		closeLatch.await();
	}
}
