读写分离-oauth
This commit is contained in:
@@ -43,11 +43,6 @@
|
||||
<artifactId>accompany-business-community-sdk</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.accompany</groupId>
|
||||
<artifactId>accompany-sharding-sdk</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.accompany</groupId>
|
||||
<artifactId>accompany-business-sdk</artifactId>
|
||||
|
@@ -17,6 +17,17 @@
|
||||
<groupId>com.accompany</groupId>
|
||||
<artifactId>accompany-basic-sdk</artifactId>
|
||||
<version>${revision}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<groupId>joda-time</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.accompany</groupId>
|
||||
<artifactId>accompany-sharding-service</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@@ -16,10 +16,4 @@
|
||||
<module>accompany-basic-service</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
@@ -45,11 +45,6 @@
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
@@ -89,18 +84,6 @@
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatisplus.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-jsqlparser</artifactId>
|
||||
<version>${mybatisplus.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hippo4j</groupId>
|
||||
<artifactId>hippo4j-config-spring-boot-starter</artifactId>
|
||||
|
@@ -16,10 +16,4 @@
|
||||
<module>accompany-payment-service</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
@@ -18,11 +18,30 @@
|
||||
<artifactId>accompany-sharding-sdk</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.shardingsphere</groupId>
|
||||
<artifactId>shardingsphere-jdbc</artifactId>
|
||||
<version>${sharding-jdbc.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatisplus.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-jsqlparser</artifactId>
|
||||
<version>${mybatisplus.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@@ -1,4 +1,4 @@
|
||||
package com.accompany.core.config;
|
||||
package com.accompany.sharding.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
@@ -1,4 +1,4 @@
|
||||
package com.accompany.core.config;
|
||||
package com.accompany.sharding.config;
|
||||
|
||||
import com.accompany.common.utils.ResourceUtil;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import com.github.pagehelper.PageInterceptor;
|
||||
import org.apache.ibatis.plugin.Interceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.annotation.*;
|
@@ -12,6 +12,7 @@ import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
|
||||
import org.apache.shardingsphere.mode.repository.standalone.StandalonePersistRepositoryConfiguration;
|
||||
import org.apache.shardingsphere.readwritesplitting.config.ReadwriteSplittingRuleConfiguration;
|
||||
import org.apache.shardingsphere.readwritesplitting.config.rule.ReadwriteSplittingDataSourceGroupRuleConfiguration;
|
||||
import org.apache.shardingsphere.readwritesplitting.transaction.TransactionalReadQueryStrategy;
|
||||
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
|
||||
import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
|
||||
import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
|
||||
@@ -64,7 +65,7 @@ public class ShardingSphereConfig {
|
||||
ModeConfiguration modeConfig = new ModeConfiguration("Standalone", new StandalonePersistRepositoryConfiguration("JDBC", new Properties()));
|
||||
//是否打印执行的sql语句
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("sql-show", "true");
|
||||
properties.setProperty("sql-show", "false");
|
||||
|
||||
return ShardingSphereDataSourceFactory.createDataSource(modeConfig, dataSourceMap, ruleConfigs, properties);
|
||||
}
|
||||
@@ -97,8 +98,9 @@ public class ShardingSphereConfig {
|
||||
}
|
||||
|
||||
private ReadwriteSplittingRuleConfiguration getReadWriteRuleConfig() {
|
||||
//同一事务下强制使用主库
|
||||
ReadwriteSplittingDataSourceGroupRuleConfiguration dataSourceGroupConfig = new ReadwriteSplittingDataSourceGroupRuleConfiguration(
|
||||
"ds", "ds", Arrays.asList("ds", "ds_slave"), "weight_lb");
|
||||
"ds", "ds", Arrays.asList("ds", "ds_slave"), TransactionalReadQueryStrategy.PRIMARY, "weight_lb");
|
||||
Properties algorithmProps = new Properties();
|
||||
algorithmProps.setProperty("ds_slave", "3");
|
||||
algorithmProps.setProperty("ds", "1");
|
||||
|
@@ -16,10 +16,4 @@
|
||||
<module>accompany-sharding-service</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
@@ -16,10 +16,4 @@
|
||||
<module>accompany-sms-service</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
@@ -16,10 +16,4 @@
|
||||
<module>accompany-business-community-service</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
@@ -21,10 +21,4 @@
|
||||
<module>fastival-activity-mq</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
@@ -43,11 +43,6 @@
|
||||
<artifactId>accompany-business-world-service</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.accompany</groupId>
|
||||
<artifactId>accompany-sharding-service</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.accompany</groupId>
|
||||
<artifactId>festival-activity-sdk</artifactId>
|
||||
|
@@ -16,10 +16,4 @@
|
||||
<module>accompany-business-world-service</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
@@ -18,10 +18,4 @@
|
||||
<module>accompany-mq-web</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
@@ -13,6 +13,11 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.accompany</groupId>
|
||||
<artifactId>accompany-core</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.accompany</groupId>
|
||||
<artifactId>accompany-oauth2-sdk</artifactId>
|
||||
|
@@ -13,11 +13,6 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.accompany</groupId>
|
||||
<artifactId>accompany-core</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.accompany</groupId>
|
||||
<artifactId>accompany-oauth2-service</artifactId>
|
||||
|
Reference in New Issue
Block a user