初始化第一版influxORM
This commit is contained in:
44
src/main/java/com/njcn/influx/config/InfluxDbConfig.java
Normal file
44
src/main/java/com/njcn/influx/config/InfluxDbConfig.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.njcn.influx.config;
|
||||
|
||||
import com.njcn.influx.base.ProxyMapperRegister;
|
||||
import com.njcn.influx.core.InfluxExecutor;
|
||||
import org.influxdb.InfluxDB;
|
||||
import org.influxdb.impl.InfluxDBMapper;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
*/
|
||||
@Configuration
|
||||
public class InfluxDbConfig {
|
||||
|
||||
|
||||
/***
|
||||
* influxMapper存放路径
|
||||
*/
|
||||
@Value("${spring.influx.mapper-location}")
|
||||
private String mapperLocation;
|
||||
|
||||
@Bean(name = "influxDbMapper")
|
||||
public InfluxDBMapper influxDBMapper(InfluxDB influxDb) {
|
||||
influxDb.setLogLevel(InfluxDB.LogLevel.BASIC);
|
||||
return new InfluxDBMapper(influxDb);
|
||||
}
|
||||
|
||||
@Bean(name = "influxDbExecutor")
|
||||
public InfluxExecutor executor(InfluxDB influxDb, InfluxDBMapper influxDbMapper) {
|
||||
return new InfluxExecutor(influxDb, influxDbMapper);
|
||||
}
|
||||
|
||||
@Bean(name = "proxyMapperRegister")
|
||||
public ProxyMapperRegister proxyMapperRegister(ConfigurableApplicationContext applicationContext, ResourceLoader resourceLoader) {
|
||||
return new ProxyMapperRegister(mapperLocation, applicationContext, resourceLoader);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user