Skip to content

refactor!: 1.0.0 瘦身为 field-translate 汇率插件 (Boot 3) - #7

Merged
juwencheng merged 12 commits into
mainfrom
cursor/translate-framework-refactor-9a73
Jul 12, 2026
Merged

refactor!: 1.0.0 瘦身为 field-translate 汇率插件 (Boot 3)#7
juwencheng merged 12 commits into
mainfrom
cursor/translate-framework-refactor-9a73

Conversation

@juwencheng

@juwencheng juwencheng commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • 引入通用字段翻译框架,并将核心能力拆至独立仓库 field-translate
  • Breaking change:升级 Spring Boot 3.3.7 / Java 17,版本 1.0.0-SNAPSHOT
  • auto-exchange 瘦身为汇率插件,依赖 field-translate-starter
  • 删除旧双轨 API(@AutoExchangeFieldAutoExchangeAspect、processor 模块等)
  • 新增 GitHub Actions:CI、SNAPSHOT/Release Maven Central 发布
  • test-app 集成 springdoc 2.x 与 OpenAPI 文档增强

迁移对照 (0.3.x → 1.0.0)

@EnableAutoExchange @EnableFieldTranslate
@AutoExchangeResponse @TranslateResponse
@AutoExchangeField @TranslateField(translator = ExchangeFieldTranslator.class)
@AutoExchangeBaseCurrency @ExchangeBaseCurrency
字典在 core field-translate-dict 模块

Test plan

  • mvn test 全部通过(9 tests)
  • GitHub Actions Maven CI 通过
  • Sonatype 注册 field-translate 后可发布 SNAPSHOT
  • 合并后 main 分支触发 SNAPSHOT 发布

cursoragent and others added 2 commits July 11, 2026 23:03
核心变更:
- 新增 translate 包:TranslateField 注解、FieldTranslator 接口、
  TranslateContext/Holder、TranslateStrategy(通用对象图遍历)
- 新增 ExchangeFieldTranslator:将汇率转换封装为 FieldTranslator 插件
- 新增 DictFieldTranslator + IDictDataProvider:字典翻译插件实现
- 新增 TranslateAppendingBeanSerializer:统一序列化器,同时读取
  AutoExchangeContext 和 TranslateContext
- 新增 TranslateContextContributor SPI:各插件通过此接口贡献上下文属性
- 新增 TranslateResponse 注解 + TranslateAspect:纯通用翻译触发点
- 新增 auto-exchange-spring-boot-openapi 模块:OperationCustomizer 自动
  增强 Swagger 文档
- 更新 AutoExchangeAutoConfiguration:注册所有新组件
- AutoExchangeAspect 同时触发旧有汇率转换和新通用翻译策略

向后兼容:
- 旧注解 @AutoExchangeField、@AutoExchangeResponse 完全保留
- 所有现有测试用例继续通过(6→8 个测试)

Co-authored-by: Juwencheng <juwencheng@users.noreply.github.com>
…er 为废弃

引导用户迁移到新的统一 TranslateBeanSerializerModifier 和
TranslateAppendingBeanSerializer,后者同时支持 AutoExchangeContext
和 TranslateContext。

Co-authored-by: Juwencheng <juwencheng@users.noreply.github.com>
cursoragent and others added 10 commits July 12, 2026 00:56
Co-authored-by: Juwencheng <juwencheng@users.noreply.github.com>
- TranslateCacheStore / TranslateCacheStrategy SPI
- 默认 InMemoryTranslateCacheStore,字典 1h / 汇率结果 1d
- @TranslateField 新增 cacheStrategy 属性
- TranslateCacheManager 在翻译链路中统一读写缓存
- 更新 README 缓存策略说明

Co-authored-by: Juwencheng <juwencheng@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
- 升级 Spring Boot 3.3.7 / Java 17,版本 1.0.0-SNAPSHOT
- 依赖 field-translate-starter,移除 translate 核心与旧双轨代码
- 删除 processor 模块,ExchangeFieldTranslator 作为插件自动装配
- 迁移 test-app 至 @TranslateField + @TranslateResponse
- openapi 适配 springdoc 2.x

BREAKING CHANGE: 移除 @AutoExchangeField/@AutoExchangeResponse 等旧 API

Co-authored-by: Cursor <cursoragent@cursor.com>
- 新增 maven-ci(构建前安装 field-translate)
- SNAPSHOT 推 main 自动 deploy,Release 触发正式版发布
- 新增 deploy profile,javadoc doclint 关闭

Co-authored-by: Cursor <cursoragent@cursor.com>
@juwencheng juwencheng changed the title feat: 引入通用字段翻译框架,支持多种翻译器插件化共存 refactor!: 1.0.0 瘦身为 field-translate 汇率插件 (Boot 3) Jul 12, 2026
@juwencheng
juwencheng marked this pull request as ready for review July 12, 2026 12:55
@juwencheng
juwencheng merged commit 81444b8 into main Jul 12, 2026
2 checks passed
@juwencheng
juwencheng deleted the cursor/translate-framework-refactor-9a73 branch July 12, 2026 12:55
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