com.bizmda.bizsip.integrator.config.MagicApiConfiguration Maven / Gradle / Ivy
package com.bizmda.bizsip.integrator.config;
import com.bizmda.bizsip.integrator.magicapi.CacheConfig;
import com.bizmda.bizsip.integrator.magicapi.MagicAPIProperties;
import com.bizmda.bizsip.integrator.magicapi.PageConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.jdbc.core.ColumnMapRowMapper;
import org.springframework.jdbc.core.RowMapper;
import org.ssssssss.magicapi.cache.DefaultSqlCache;
import org.ssssssss.magicapi.cache.SqlCache;
import org.ssssssss.magicapi.config.MagicDynamicDataSource;
import org.ssssssss.magicapi.functions.RedisFunctions;
import org.ssssssss.magicapi.functions.SQLExecutor;
import org.ssssssss.magicapi.provider.PageProvider;
import org.ssssssss.magicapi.provider.ResultProvider;
import org.ssssssss.magicapi.provider.impl.DefaultPageProvider;
import org.ssssssss.magicapi.provider.impl.DefaultResultProvider;
import javax.sql.DataSource;
import java.util.Map;
@Slf4j
@Configuration
//@AutoConfigureBefore(IntegratorConfiguration.class)
//@EnableAutoConfiguration
public class MagicApiConfiguration {
@Autowired
private MagicAPIProperties magicAPIProperties;
/**
* 注入数据库查询模块
*/
@Bean
public SQLExecutor magicSQLExecutor(MagicDynamicDataSource dynamicDataSource, ResultProvider resultProvider, PageProvider pageProvider, SqlCache sqlCache) {
RowMapper