Skip to content

Commit

Permalink
🔖 发布v2.3.9版本
Browse files Browse the repository at this point in the history
  • Loading branch information
hengboy committed Sep 18, 2023
1 parent 3283b27 commit f88121b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 11 deletions.
1 change: 0 additions & 1 deletion api-boot-project/api-boot-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@
<artifactId>guava</artifactId>
<optional>true</optional>
</dependency>

</dependencies>
<build>
<resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import org.minbox.framework.datasource.aop.interceptor.DataSourceSwitchAnnotationInterceptor;
import org.minbox.framework.datasource.config.DataSourceConfig;
import org.minbox.framework.datasource.config.DataSourceDruidConfig;
import org.minbox.framework.datasource.routing.ApiBootRoutingDataSource;
import org.minbox.framework.datasource.routing.MinBoxSwitchRoutingDataSource;
import org.minbox.framework.datasource.routing.customizer.DataSourceSelectionCustomizer;
import org.minbox.framework.datasource.support.MinBoxDruidDataSource;
import org.minbox.framework.datasource.support.MinBoxHikariDataSource;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
Expand Down Expand Up @@ -38,10 +40,13 @@ public class ApiBootDataSourceSwitchAutoConfiguration {
/**
* ApiBoot DataSource Switch Properties
*/
private ApiBootDataSourceSwitchProperties apiBootDataSourceSwitchProperties;
private ApiBootDataSourceSwitchProperties dataSourceSwitchProperties;
private DataSourceSelectionCustomizer selectionCustomizer;

public ApiBootDataSourceSwitchAutoConfiguration(ApiBootDataSourceSwitchProperties apiBootDataSourceSwitchProperties) {
this.apiBootDataSourceSwitchProperties = apiBootDataSourceSwitchProperties;
public ApiBootDataSourceSwitchAutoConfiguration(ApiBootDataSourceSwitchProperties dataSourceSwitchProperties,
ObjectProvider<DataSourceSelectionCustomizer> customizerObjectProvider) {
this.dataSourceSwitchProperties = dataSourceSwitchProperties;
this.selectionCustomizer = customizerObjectProvider.getIfAvailable();
}

/**
Expand Down Expand Up @@ -71,9 +76,9 @@ public DataSource dataSource(DataSourceFactoryBean dataSourceFactoryBean) {
Map<String, DataSourceConfig> dataSourceConfigMap = new HashMap(1);

// put druid datasource config to map
dataSourceConfigMap.putAll(apiBootDataSourceSwitchProperties.getDruid());
dataSourceConfigMap.putAll(dataSourceSwitchProperties.getDruid());
// put hikari datasource config to map
dataSourceConfigMap.putAll(apiBootDataSourceSwitchProperties.getHikari());
dataSourceConfigMap.putAll(dataSourceSwitchProperties.getHikari());

// convert all datasource config
dataSourceConfigMap.keySet().stream().forEach(poolName -> {
Expand All @@ -87,7 +92,7 @@ public DataSource dataSource(DataSourceFactoryBean dataSourceFactoryBean) {
dataSourceConfigList.add(dataSourceConfig);
});

return new ApiBootRoutingDataSource(dataSourceFactoryBean, apiBootDataSourceSwitchProperties.getPrimary(), dataSourceConfigList);
return new MinBoxSwitchRoutingDataSource(dataSourceFactoryBean, dataSourceSwitchProperties.getPrimary(), dataSourceConfigList, selectionCustomizer);
}

/**
Expand Down
8 changes: 7 additions & 1 deletion api-boot-project/api-boot-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
<artifactId>api-boot-dependencies</artifactId>
<properties>
<main.basedir>${basedir}/../..</main.basedir>
<spring.boot.version>2.7.3</spring.boot.version>
<spring.boot.version>2.7.15</spring.boot.version>
<spring-cloud.version>3.1.0</spring-cloud.version>
<maven-plugin-plugin.version>3.6.2</maven-plugin-plugin.version>
<build-helper-maven-plugin.version>3.2.0</build-helper-maven-plugin.version>
<xml-maven-plugin.version>1.0.2</xml-maven-plugin.version>
<minbox-datasource-switch.version>1.0.3</minbox-datasource-switch.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -159,6 +160,11 @@
<artifactId>api-boot-starter-grace</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.minbox.framework</groupId>
<artifactId>minbox-datasource-switch</artifactId>
<version>${minbox-datasource-switch.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
12 changes: 11 additions & 1 deletion api-boot-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<!--Samples所使用的ApiBoot版本-->
<api-boot.version>${project.version}</api-boot.version>
<!--Samples所使用的SpringBoot版本-->
<spring-boot.version>2.7.3</spring-boot.version>
<spring-boot.version>2.7.15</spring-boot.version>
<mysql.version>8.0.33</mysql.version>
</properties>
<artifactId>api-boot-samples</artifactId>
<packaging>pom</packaging>
Expand Down Expand Up @@ -48,4 +49,13 @@
<module>api-boot-sample-ssh-agent</module>
<module>api-boot-sample-grace</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<version>${revision}</version>
<name>ApiBoot Build</name>
<properties>
<revision>2.3.9-SNAPSHOT</revision>
<revision>2.3.9</revision>
<jdk.version>1.8</jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
Expand Down

0 comments on commit f88121b

Please sign in to comment.