package com.njcn.influxdb.config;

import com.njcn.influxdb.utils.InfluxDbUtils;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * 类的介绍：
 *
 * @author xuyang
 * @version 1.0.0
 * @createTime 2021/12/10 10:48
 */
@Data
@Component
@ConfigurationProperties(prefix = "spring.influx")
public class InfluxDbConfig {

    private String url;

    private String user;

    private String password;

    private String database;

    @Bean
    public InfluxDbUtils influxDbUtils() {
        return new InfluxDbUtils(user, password, url, database, "autogen");
    }
}
