package com.yfd.platform;

import com.yfd.platform.annotation.rest.AnonymousGetMapping;
import com.yfd.platform.utils.SpringContextHolder;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * //@SpringBootApplication
 */
@RestController
@EnableTransactionManagement
@EnableAsync
@ServletComponentScan("com.yfd.platform.config")
@MapperScan(basePackages = "com.yfd.platform.modules.*.mapper,com.yfd.platform.*.mapper")
@SpringBootApplication
@EnableScheduling
@EnableCaching
@EnableGlobalMethodSecurity(prePostEnabled=true)
public class PlatformApplication {

	public static void main(String[] args) {
		SpringApplication.run(PlatformApplication.class, args);
	}

	@Bean
	public SpringContextHolder springContextHolder() {
		return new SpringContextHolder();
	}

    static {
        System.setProperty("druid.mysql.usePingMethod","false");
    }
	/**
	 * 访问首页提示
	 *
	 * @return /
	 */
	@AnonymousGetMapping("/")
	public String index() {
		return "Backend service started successfully";
	}
}
