package com.lanyuanxiaoyao.service.zookeeper;

import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.retry.annotation.EnableRetry;

/**
 * zk 查询
 *
 * @author lanyuanxiaoyao
 * @date 2023-05-13
 */
@EnableDiscoveryClient
@SpringBootApplication(
        scanBasePackages = {"com.lanyuanxiaoyao.service"},
        exclude = {GsonAutoConfiguration.class}
)
@EnableConfigurationProperties
@EnableEncryptableProperties
@EnableRetry
public class ZookeeperQueryApplication implements ApplicationRunner {
    private static final Logger logger = LoggerFactory.getLogger(ZookeeperQueryApplication.class);
    private final ZookeeperConfiguration zookeeperConfiguration;

    public ZookeeperQueryApplication(ZookeeperConfiguration zookeeperConfiguration) {
        this.zookeeperConfiguration = zookeeperConfiguration;
    }

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

    @Override
    public void run(ApplicationArguments args) {
        logger.info("Connect string: {}", zookeeperConfiguration.getConnectUrl());
    }
}
