Skip to content

Upgrade to Spring Boot 3 / Java 17 and add ThriftClientHeaderCustomizer hook#51

Open
rpajaziti wants to merge 7 commits intoaatarasoff:masterfrom
rpajaziti:upstream-pr
Open

Upgrade to Spring Boot 3 / Java 17 and add ThriftClientHeaderCustomizer hook#51
rpajaziti wants to merge 7 commits intoaatarasoff:masterfrom
rpajaziti:upstream-pr

Conversation

@rpajaziti
Copy link
Copy Markdown

What this PR does

This fork upgrades the library to Spring Boot 3 / Java 17 and adds a hook for custom header propagation on the client side.

Changes

Spring Boot 3 / Java 17 upgrade

  • Migrated all dependencies and configuration to Spring Boot 3.2.5
  • Updated to Java 17 source/target compatibility
  • Replaced deprecated APIs and javax imports with jakarta equivalents

ThriftClientHeaderCustomizer hook

  • New @FunctionalInterface that allows consumers to inject custom HTTP headers into every outgoing Thrift call without touching the library internals
  • Called per method invocation so headers like transaction IDs are always fresh
  • Headers are cleared automatically on pool return via existing passivateObject() cleanup
  • The library has zero knowledge of what fills the hook — Seata XID, Brave trace headers, auth tokens, anything

Dependency version pinning

  • All api dependencies in starter/build.gradle now have pinned versions
  • Consumers no longer need to import the Spring Cloud or Spring Boot BOM to resolve transitive dependencies

Usage example

@Bean
public ThriftClientHeaderCustomizer seataHeaderCustomizer() {
    return () -> {                                                                                                                                                                                                                                                                                                           
        String xid = RootContext.getXID();
        return StringUtils.hasText(xid) ? Map.of(RootContext.KEY_XID, xid) : Map.of();                                                                                                                                                                                                                                       
    };                                                                                                                                                                                                                                                                                                                       
}

Ramadan Pajaziti added 7 commits March 25, 2026 21:09
  - Upgrade Spring Boot to 3.2.5 and Spring Cloud to 2023.0.2
  - Migrate from Java 11 to Java 17 (sourceCompatibility, CI workflows)
  - Replace spring-cloud-sleuth with micrometer-tracing (Brave bridge)
  - Replace Nebula plugins with standard java-library + maven-publish
  - Migrate @Autowired field injection to constructor injection (@requiredargsconstructor)
  - Add ThriftClientHeaderCustomizer SPI for propagating custom headers
  - Add @ConditionalOnClass(LoadBalancerClient.class) for optional load balancer support
  - Migrate Spring Boot auto-configuration to new spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  - Update Gradle wrapper and dependency versions
  - Fix publish workflow JDK version from 11 to 17
…tion, header customizer docs, and fix dependency declaration
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.

1 participant