package com.inspect.admin;

import com.inspect.common.security.annotation.EnableRyFeignClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ComponentScan;

@EnableRyFeignClients
@ComponentScan({"com.inspect.*"})
@SpringBootApplication(
        exclude = {DataSourceAutoConfiguration.class}
)
public class InspectAuthApplication {
    private final static Logger log = LoggerFactory.getLogger(InspectAuthApplication.class);
    public static void main(String[] args) {
        SpringApplication.run(InspectAuthApplication.class, args);

//        SpringApplicationBuilder builder = new SpringApplicationBuilder(InspectAuthApplication.class)
//                .beanNameGenerator(new CustomGenerator());
//        builder.run(args);
        log.info("\n<=====☆  AUTH MODULE ☆ =====>  \n .-------.       ____     __        \n |  _ _   \\      \\   \\   /  /    \n | ( ' )  |       \\  _. /  '       \n |(_ o _) /        _( )_ .'         \n | (_,_).' __  ___(_ o _)'          \n |  |\\ \\  |  ||   |(_,_)'         \n |  | \\ `'   /|   `-'  /           \n |  |  \\    /  \\      /           \n ''-'   `'-'    `-..-'              ");
    }

    public static class CustomGenerator implements BeanNameGenerator {
        @Override
        public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
            return definition.getBeanClassName();
        }
    }
}
