fix(wx-java-mp): 修复无法回退到 RedissonClient 回退逻辑#4048
Conversation
改为通过实际配置项 wx.mp.config-storage.redis.host 判断是否使用内置 wxMpRedissonClient,避免 RedisProperties 默认 host 导致始终无法回退到 用户自定义 RedissonClient bean。
|
@codex 帮忙review下,注意最终使用中文给出建议 |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🤖 Augment PR SummarySummary: 修复 Solon 版 wx-java-mp 在未显式配置 Redis host 时无法回退到用户自定义 🤖 Was this summary useful? React with 👍 or 👎 |
| String configuredHost = applicationContext.cfg().get(WxMpProperties.PREFIX + ".config-storage.redis.host"); | ||
| RedissonClient redissonClient; | ||
| if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) { | ||
| if (StringUtils.isNotEmpty(configuredHost)) { |
There was a problem hiding this comment.
这里用 StringUtils.isNotEmpty(configuredHost) 会把 wx.mp.config-storage.redis.host=(空值但 key 存在)视为“未配置”。但 wxMpRedissonClient() 的 @Condition(onProperty=...) 在 Solon 语义上是“有属性即可”,可能仍会创建内置 bean,导致选择逻辑与 bean 是否存在不一致(甚至空 host 下初始化失败)。
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
|
@binarywang augment review |
你直接回复他,然后resolve 即可,不一定都要按ai的建议来做 |
按当前 Solon 版代码的常规配置路径
原因:
WxMpProperties.ConfigStorage.redis 是 final new RedisProperties(), 通常不为 null
RedisProperties.host 默认是 "127.0.0.1"
所以即使用户没有配置 wx.mp.config-storage.redis.host,getHost() 也非空
修改:
改为通过实际配置项 wx.mp.config-storage.redis.host判断是否使用内置 wxMpRedissonClient,
避免 RedisProperties 默认 host 导致始终无法回退到 用户自定义 RedissonClient bean。