Skip to content

Commit

Permalink
Fixes CI errors caused by Druid changes
Browse files Browse the repository at this point in the history
  • Loading branch information
linghengqian committed Jan 2, 2024
1 parent 8f633a5 commit 5ce30ca
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 23 deletions.
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Git Mirror 位于 https://github.com/baomidou/dynamic-datasource 。
当项目导入 IntelliJ IDEA 或 VSCode 时,IDE 对项目的语言级别应当设置为 8。
对于单独的 `com.baomidou:dynamic-datasource-spring-boot3-starter` 子模块,IDE 的语言级别应当设置为 17。

提交 PR 前,应在 OpenJDK 17 下执行 `./mvnw -T1C -B clean test` 以验证更改是否未破坏单元测试。若有需要请补充或更改单元测试。
提交 PR 前,应在 OpenJDK 17 下执行 `./mvnw -T1C clean test` 以验证更改是否未破坏单元测试。若有需要请补充或更改单元测试。

假设贡献者处于新的 Ubuntu 22.04.3 LTS 实例下,其可通过如下 bash 命令来通过 SDKMAN! 管理 JDK 和工具链,并执行单元测试。

Expand All @@ -22,7 +22,7 @@ sdk use java 17.0.8-ms

git clone [email protected]:baomidou/dynamic-datasource.git
cd ./dynamic-datasource/
./mvnw -T1C -B clean test
./mvnw -T1C clean test
```

## 2.1. Execute NativeTest under GraalVM Native Image
Expand Down Expand Up @@ -68,7 +68,7 @@ System Property 屏蔽部分单元测试在 GraalVM Native Image 下运行。
已有的 GraalVM Reachability Metadata 文件。可通过如下 bash 命令简单处理此流程。贡献者仍可能需要手动调整具体的 JSON 条目,并在适当的时候
调整 Maven Profile 和 GraalVM Tracing Agent 的 Filter 链。

以下命令仅为 `dynamic-datasource-spring-boot3-starter` 生成 Conditioanl 形态的 GraalVM Reachability Metadata 的一个举例。
以下命令仅为 `dynamic-datasource-spring-boot3-starter` 生成 Conditional 形态的 GraalVM Reachability Metadata 的一个举例。

对于测试类和测试文件独立使用的 GraalVM Reachability Metadata,贡献者应该放置到相关子模块对应的
`${project.basedir}/src/test/resources/META-INF/native-image/${project.artifactId}-test-metadata/` 文件夹下。`${}` 内为
Expand All @@ -78,7 +78,6 @@ POM 4.0 的常规系统变量,自行替换。
git clone [email protected]:baomidou/dynamic-datasource.git
cd ./dynamic-datasource/
./mvnw -PgenerateMetadata -DskipNativeTests -e -T1C clean test native:metadata-copy
./mvnw -PnativeTestInSpringBoot -T1C -e clean test
```

请手动删除无任何具体条目的 JSON 文件。
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ dynamic-datasource-spring-boot-starter 是一个基于springboot的快速集成

详细文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/2264611

## 贡献 | Contributing

我们欢迎社区的贡献,请查看 [CONTRIBUTING.md](./CONTRIBUTING.md)

# 特性

- 支持 **数据源分组** ,适用于多种场景 纯粹多库 读写分离 一主多从 混合模式。
Expand Down
5 changes: 0 additions & 5 deletions dynamic-datasource-spring-boot-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions dynamic-datasource-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
<artifactId>spring-boot-starter-web</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
Expand Down
7 changes: 6 additions & 1 deletion dynamic-datasource-spring-boot3-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<properties>
<java.version>17</java.version>
<spring-boot-dependencies.version>3.2.1</spring-boot-dependencies.version>
<spring-boot-dependencies.version>3.1.5</spring-boot-dependencies.version>
</properties>

<dependencies>
Expand All @@ -29,6 +29,11 @@
<artifactId>spring-boot-starter-web</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-3-starter</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.baomidou.dynamic.datasource.spring.boot.autoconfigure;

import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
import com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties;
import com.alibaba.druid.spring.boot3.autoconfigure.stat.DruidFilterConfiguration;
import com.alibaba.druid.spring.boot3.autoconfigure.stat.DruidSpringAopConfiguration;
import com.alibaba.druid.spring.boot3.autoconfigure.stat.DruidStatViewServletConfiguration;
import com.alibaba.druid.spring.boot3.autoconfigure.stat.DruidWebStatFilterConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
* 从原生DruidDataSourceAutoConfigure复制
*
* @author TaoYu
* @since 1.1.0
*/
@Configuration
@ConditionalOnClass(DruidDataSourceAutoConfigure.class)
@EnableConfigurationProperties({DruidStatProperties.class})
@Import({
DruidSpringAopConfiguration.class,
DruidStatViewServletConfiguration.class,
DruidWebStatFilterConfiguration.class,
DruidFilterConfiguration.class})
public class DruidDynamicDataSourceConfiguration {

}
29 changes: 16 additions & 13 deletions native-image/extra-filter.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
{
"rules": [
{"includeClasses": "**"},

{"excludeClasses": "java.lang.management.**"},
{"excludeClasses": "jdk.management.**"},
{"excludeClasses": "com.sun.management.**"},
{"excludeClasses": "sun.management.**"},
{"excludeClasses": "javax.management.**"},

{"excludeClasses": "com.ibm.icu.text.**"},
{"excludeClasses": "java.**"},
{"includeClasses": "java.util.Properties"},
{"includeClasses": "java.lang.Thread"},
{"excludeClasses": "sun.misc.**"},
{"excludeClasses": "sun.security.**"},
{"excludeClasses": "com.ibm.icu.text.**"},
{"excludeClasses": "javax.naming.**"},
{"excludeClasses": "javax.sql.**"},
{"excludeClasses": "org.h2.**"},
{"excludeClasses": "oracle.ucp.**"},
{"excludeClasses": "org.apache.tomcat.jdbc.**"},
{"excludeClasses": "org.apache.commons.**"},
{"excludeClasses": "sun.misc.**"},
{"excludeClasses": "sun.security.**"},

{"excludeClasses": "com.alibaba.druid.**"},
{"excludeClasses": "com.baomidou.mybatisplus.**"},
{"excludeClasses": "com.fasterxml.jackson.**"},
{"excludeClasses": "com.mchange.v2.**"},
{"excludeClasses": "com.zaxxer.**"},
{"excludeClasses": "com.alibaba.druid.**"},
{"excludeClasses": "org.springframework.**"},
{"excludeClasses": "org.apache.ibatis.binding.**"},
{"excludeClasses": "jakarta.servlet.**"},
{"excludeClasses": "com.fasterxml.jackson.**"},
{"excludeClasses": "com.baomidou.mybatisplus.**"}

{"excludeClasses": "oracle.ucp.**"},
{"excludeClasses": "org.apache.commons.**"},
{"excludeClasses": "org.apache.ibatis.**"},
{"excludeClasses": "org.apache.tomcat.jdbc.**"},
{"excludeClasses": "org.h2.**"},
{"excludeClasses": "org.mybatis.spring.**"},
{"excludeClasses": "org.springframework.**"}
],
"regexRules": [
{"excludeClasses": ".*fixture*.*"},
Expand Down

0 comments on commit 5ce30ca

Please sign in to comment.