Skip to content

feat: 新增 refresh-datasource-sample - #57

Open
huayanYu wants to merge 1 commit into
masterfrom
feat/refresh-datasource-from-config
Open

huayanYu wants to merge 1 commit into
masterfrom
feat/refresh-datasource-from-config

Conversation

@huayanYu

Copy link
Copy Markdown
Contributor

演示配置中心变更后如何安全地刷新数据源:把一份新配置交给 DynamicDataSourceRefresher,由它 diff 后只重建变化的连接池。同时给出 spring.datasource.dynamic.refresh-enabled=true 的零代码用法。

依赖 baomidou/dynamic-datasource#805。

⚠️ 请在 4.7.0 发布之后再合并:本示例用到 DynamicDataSourceRefresher,而 pom 里的 ds.version 仍是 4.6.0,
该版本尚未包含这个 API,合并前本 sample 的编译会失败。4.7.0 发布后
notify-samples 会开 chore/bump-ds-4.7.0 PR 推进 ds.version,之后即可合并。

本地验证方式(需先本地安装主仓库 4.7.0 构件):

./mvnw -B -pl spring-boot-4/refresh-datasource-sample -am test -Dds.version=4.7.0

演示把一份新配置交给 DynamicDataSourceRefresher 完成增量刷新,
同时给出 spring.datasource.dynamic.refresh-enabled 的自动刷新用法。

@linghengqian linghengqian left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linghengqian linghengqian added the enhancement New feature or request label Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants