Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes CI exception since #37 and update doc #39

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,8 @@ name: CI
on:
push:
branches: [ master ]
paths:
- '.github/workflows/ci.yml'
- '**/pom.xml'
- '**/src/main/**'
- '**/src/test/**'
pull_request:
branches: [ master ]
paths:
- '.github/workflows/ci.yml'
- '**/pom.xml'
- '**/src/main/**'
- '**/src/test/**'

concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -43,6 +33,7 @@ jobs:
- name: Build all test with Maven
run: |
./mvnw -T1C -B -e clean test

test-minimum-hotspot-jdk-ci:
name: Test CI - JDK ${{ matrix.java-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

大部分数据库连接为 H2Database,仅供测试。

所有单元测试可在 OpenJDK 17 / OpenJDK 21 及其下游发行版执行,并在 Github Actions 完成验证。
除开 `com.baomidou:springboot3-sample`, 其他子模块均可在 [OpenJDK 8, OpenJDK 21] 的 JDK 范围及其下游发行版下执行单元测试。

除开 `com.baomidou:springboot3-sample`, 其他子模块均可在 OpenJDK 8 - OpenJDK 21 及其下游发行版下执行单元测试。

你可能希望参考 [位于 Github Actions 的 CI 文件](./.github/workflows/ci.yml)。
所有单元测试在 Github Actions 完成验证。 你可能希望参考 [位于 Github Actions 的 CI 文件](./.github/workflows/ci.yml)。

- add-remove-datasource 动态添加删除数据源的使用示例
- all-datasource-sample 所有不同连接池使用示例(大乱炖,实际不建议)
Expand All @@ -32,7 +30,8 @@

我们欢迎社区的贡献。

在提交 Pull Request 之前, 请在本地通过 OpenJDK 17 - OpenJDK 21 下完成此命令的验证。
针对 IDE,项目的语言级别应设置为 JDK 8,对于单独的 `com.baomidou:springboot3-sample` 子模块,语言级别应设置为 JDK 17 。
在提交 Pull Request 之前, 请在本地通过 [OpenJDK 17, OpenJDK 21] 的 JDK 范围下完成此命令的验证。
我们鼓励通过 `SDKMAN!` 切换到 `21.0.1-graalce` 来验证。

```shell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
import com.baomidou.samples.ds.dto.DataSourceDTO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

Expand All @@ -31,10 +30,13 @@
@RequestMapping("/datasources")
public class DataSourceController {

@Autowired
private DataSource dataSource;
@Autowired
private DefaultDataSourceCreator dataSourceCreator;
private final DataSource dataSource;
private final DefaultDataSourceCreator dataSourceCreator;

public DataSourceController(DataSource dataSource, DefaultDataSourceCreator dataSourceCreator) {
this.dataSource = dataSource;
this.dataSourceCreator = dataSourceCreator;
}

/**
* 获取当前所有数据源
Expand Down Expand Up @@ -67,4 +69,4 @@ public String remove(@RequestParam String name) {
ds.removeDataSource(name);
return "删除成功";
}
}
}