去掉分表逻辑
This commit is contained in:
1 parent
2d0a09c734
commit
8d3cb18a46
4 files changed
+4
-139
No files matched your search
@@ -9,15 +9,11 @@ import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.shardingsphere.shardingjdbc.jdbc.core.datasource.ShardingDataSource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
||||
@@ -30,15 +26,12 @@ import com.ruoyi.framework.datasource.DynamicDataSource;
|
||||
|
||||
/**
|
||||
* druid 配置多数据源
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@DependsOn("shardingDataSource")
|
||||
@Configuration
|
||||
public class DruidConfig
|
||||
{
|
||||
@Autowired
|
||||
private ShardingDataSource shardingDataSource;
|
||||
@Bean
|
||||
@ConfigurationProperties("spring.datasource.druid.master")
|
||||
public DataSource masterDataSource(DruidProperties druidProperties)
|
||||
@@ -63,13 +56,12 @@ public class DruidConfig
|
||||
Map<Object, Object> targetDataSources = new HashMap<>();
|
||||
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
||||
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
|
||||
setDataSource(targetDataSources, DataSourceType.SHARDING.name(), "shardingDataSource");
|
||||
return new DynamicDataSource(masterDataSource, targetDataSources);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置数据源
|
||||
*
|
||||
*
|
||||
* @param targetDataSources 备选数据源集合
|
||||
* @param sourceName 数据源名称
|
||||
* @param beanName bean名称
|
||||
@@ -131,4 +123,4 @@ public class DruidConfig
|
||||
registrationBean.addUrlPatterns(commonJsPattern);
|
||||
return registrationBean;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user