package com.leanwo.activiti;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

import com.leanwo.activiti.util.LoginContextUtil;
import com.leanwo.activiti.util.ProgramStopUtil;

@SpringBootApplication
//开启Eureka的客户端发现
@EnableDiscoveryClient
//@PropertySources({
//	@PropertySource(value = "activiti.properties", ignoreResourceNotFound = true),
//})
// 扫描组件 @ComponentScan(value = "com.spriboot.controller") 配置扫描组件的路径
@ComponentScan(basePackages = {
		"com.leanwo.activiti",
        "com.leanwo.activiti.app.config",
        "com.leanwo.activiti.app.conf",
        "com.leanwo.activiti.app.repository",
        "com.leanwo.activiti.app.service",
        "com.leanwo.activiti.app.model.component",
        "org.activiti.rest",
		"test.com.leanwo"})
//启动Feign客户端
@EnableFeignClients
@EnableAutoConfiguration(exclude = {
		DataSourceAutoConfiguration.class,
		DataSourceTransactionManagerAutoConfiguration.class,
//		HibernateJpaAutoConfiguration.class
})
//@EnableJpaRepositories(basePackages = {
//		"com.leanwo.activiti.app.repository",
//})
@EnableAspectJAutoProxy
public class WorkflowApp {

	private static Logger logger = LoggerFactory.getLogger(WorkflowApp.class);

	public static void main(String[] args) throws Exception {
		
		LoginContextUtil.setUseApplicationAccount(0L);
		
		SpringApplication.run(WorkflowApp.class, args);

		ProgramStopUtil.generateStopBat();

		logger.info("工作流服务器启动成功。");
	}
}