package cn.axzo.msg.center;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;

/**
 * @author cn
 * @version 1.0
 * @description
 * @date 2023/5/30 11:01
 */
@Slf4j
@MapperScan(value = {"cn.axzo.msg.center.dal"})
@SpringBootApplication(scanBasePackages = {
        "cn.axzo.msg",
        "cn.axzo.framework.rocketmq"
})
@EnableFeignClients(basePackages = {
        "cn.axzo.log",
        "cn.axzo.pluto.api",
        "cn.axzo.basics.profiles.api",
        "cn.axzo.apollo.api"
})
/*@EnableAsync*/
public class MsgCenterApplication {
    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(MsgCenterApplication.class, args);
        Environment env = run.getEnvironment();
        log.info(
                "--------------------------------------------------------------------------------------------------------------------\n" +
                        "Application 【{}】 is running on 【{}】 environment!\n" +
                        "Api Local: \thttp://127.0.0.1:{}\n" +
                        "Mysql: \t{}\t username:{}\n" +
                        "Redis: \t{}:{}\t database:{}\n" +
                        "RabbitMQ: \t{}\t username:{}",
                env.getProperty("spring.application.name"),
                env.getProperty("spring.profiles.active"),
                env.getProperty("server.port"),
                env.getProperty("spring.datasource.url"),
                env.getProperty("spring.datasource.username"),
                env.getProperty("spring.redis.host"),
                env.getProperty("spring.redis.port"),
                env.getProperty("spring.redis.database"),
                env.getProperty("spring.rabbitmq.addresses"),
                env.getProperty("spring.rabbitmq.username") +
                        "\n----------------------------------------------------------");
    }
}
