Skip to content

fix(wx-java-mp): 修复无法回退到 RedissonClient 回退逻辑#4048

Merged
binarywang merged 1 commit into
binarywang:developfrom
moil-xm:develop
Jun 5, 2026
Merged

fix(wx-java-mp): 修复无法回退到 RedissonClient 回退逻辑#4048
binarywang merged 1 commit into
binarywang:developfrom
moil-xm:develop

Conversation

@moil-xm
Copy link
Copy Markdown
Contributor

@moil-xm moil-xm commented Jun 5, 2026

按当前 Solon 版代码的常规配置路径

if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) {
  redissonClient = applicationContext.getBean("wxMpRedissonClient");
} else {
  // 走不到`applicationContext.getBean(RedissonClient.class)`
  redissonClient = applicationContext.getBean(RedissonClient.class);
}

原因:

WxMpProperties.ConfigStorage.redisfinal new RedisProperties(), 通常不为 null
RedisProperties.host 默认是 "127.0.0.1"
所以即使用户没有配置 wx.mp.config-storage.redis.hostgetHost() 也非空

修改:

改为通过实际配置项 wx.mp.config-storage.redis.host判断是否使用内置 wxMpRedissonClient,
避免 RedisProperties 默认 host 导致始终无法回退到 用户自定义 RedissonClient bean。

改为通过实际配置项 wx.mp.config-storage.redis.host 判断是否使用内置
wxMpRedissonClient,避免 RedisProperties 默认 host 导致始终无法回退到
用户自定义 RedissonClient bean。
@moil-xm moil-xm changed the title fix(wx-java-mp-): 修复无法回退到 RedissonClient 回退逻辑 fix(wx-java-mp): 修复无法回退到 RedissonClient 回退逻辑 Jun 5, 2026
@binarywang
Copy link
Copy Markdown
Owner

@codex 帮忙review下,注意最终使用中文给出建议

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Jun 5, 2026

🤖 Augment PR Summary

Summary: 修复 Solon 版 wx-java-mp 在未显式配置 Redis host 时无法回退到用户自定义 RedissonClient 的问题。

Changes: 改为读取实际配置项 wx.mp.config-storage.redis.host 决定使用内置 wxMpRedissonClient 或回退按类型获取 RedissonClient

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

String configuredHost = applicationContext.cfg().get(WxMpProperties.PREFIX + ".config-storage.redis.host");
RedissonClient redissonClient;
if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) {
if (StringUtils.isNotEmpty(configuredHost)) {
Copy link
Copy Markdown

@augmentcode augmentcode Bot Jun 5, 2026

Choose a reason for hiding this comment

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

这里用 StringUtils.isNotEmpty(configuredHost) 会把 wx.mp.config-storage.redis.host=(空值但 key 存在)视为“未配置”。但 wxMpRedissonClient()@Condition(onProperty=...) 在 Solon 语义上是“有属性即可”,可能仍会创建内置 bean,导致选择逻辑与 bean 是否存在不一致(甚至空 host 下初始化失败)。

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@moil-xm
Copy link
Copy Markdown
Contributor Author

moil-xm commented Jun 5, 2026

@binarywang augment review
说的问题确实存在 但是我提交的是最小改动版本 并且适配这段代码原来的意思
如果按照ai的语意 这次变更偏向重构 去解决历史遗留问题

@binarywang
Copy link
Copy Markdown
Owner

@binarywang augment review 说的问题确实存在 但是我提交的是最小改动版本 并且适配这段代码原来的意思 如果按照ai的语意 这次变更偏向重构 去解决历史遗留问题

你直接回复他,然后resolve 即可,不一定都要按ai的建议来做

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@binarywang binarywang merged commit 25a3328 into binarywang:develop Jun 5, 2026
@binarywang binarywang added this to the 4.8.4 milestone Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants