Skip to content

transport: support Jetty 12 with Spring Boot BOM precedence - #154

Merged
wardseptember merged 3 commits into
trpc-group:JDK17/Springboot3from
JingkaiTang:fix/jetty12-http-transport
Nov 18, 2026
Merged

wardseptember merged 3 commits into
trpc-group:JDK17/Springboot3from
JingkaiTang:fix/jetty12-http-transport

Conversation

@JingkaiTang

@JingkaiTang JingkaiTang commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #152.

When a consumer imports Spring Boot's BOM before tRPC's BOM, Jetty 12 core artifacts are combined with the old Jetty 11 Servlet and HTTP/2 artifacts, causing HTTP server initialization to fail. Migrate the transport to Jetty 12 EE10 Servlet and renamed HTTP/2 artifacts, manage Jetty through its core and EE10 BOMs, and update the gateway WebApp dependency. The HttpExecutor contract, sessions and asynchronous Servlet responses are preserved.

The tRPC BOM now defaults to Jetty 12.0.36, matching Spring Boot 3.5.16. The framework's Spring Boot baseline remains 3.5.0. On the TLS connector, HTTP/2 and HTTP/1.1 now share the same HTTPS configuration, including Jetty's default Host/certificate check.

The regular JDK 17 and 21 PR builds run the HTTP transport tests.

Validation on Corretto 21.0.5

  • The HTTP transport module passed all 14 tests with no skips after removing the standalone consumer fixture.
  • At commit 3fcf823, the default transport and a consumer importing the Spring Boot 3.5.16 BOM first both resolved Jetty 12.0.36. The consumer passed all 14 tests on JDK 17 and JDK 21.
  • The TLS fallback regression negotiates HTTP/1.1 on the HTTP/2 connector, checks that the servlet sees HTTPS and a secure request, and verifies a 400 response for a Host outside the test certificate.

@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.77198%. Comparing base (221d755) to head (4bfe681).

Additional details and impacted files

Impacted file tree graph

@@                      Coverage Diff                      @@
##             JDK17/Springboot3        #154         +/-   ##
=============================================================
- Coverage             85.78765%   85.77198%   -0.01568%     
  Complexity                 450         450                 
=============================================================
  Files                      558         558                 
  Lines                    17330       17332          +2     
  Branches                  1509        1509                 
=============================================================
- Hits                     14867       14866          -1     
- Misses                    2463        2466          +3     
Flag Coverage Δ
Merge ?
pull-request 85.77198% <100.00000%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...transport/http/support/jetty/JettyHttp2Server.java 100.00000% <ø> (ø)
.../transport/http/support/jetty/JettyHttpServer.java 92.30769% <100.00000%> (+0.30768%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

<jetty.alpn.boot.version>8.1.13.v20181017</jetty.alpn.boot.version>
<jetty.version>11.0.25</jetty.version>
<jetty.version>12.1.14</jetty.version>
<joda-time.version>2.7</joda-time.version>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

SpringBoot 3.5 实际管理的 12.0.x,jetty是不是用12.0.x。SpringBoot 4.x应该有下一个trpc版本兼容,trpc2.x不用兼容这个

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已在 3fcf823 把默认 Jetty 调整为 12.0.36,与 Spring Boot 3.5.16 管理的版本一致。这个 PR 的兼容范围收回到 Boot 3,Boot 4 留给后续版本处理。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ok

@@ -21,10 +21,9 @@
import com.tencent.trpc.core.rpc.def.DefProviderInvoker;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Image 这两个问题帮改一下?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

HTTP/1.1 回退已改用 httpsConfig,与同一端口上的 HTTP/2 共用 HTTPS 配置。补了实际协商到 HTTP/1.1 的测试,确认 Servlet 读到的 scheme 是 https,isSecure() 为 true。

Host 校验这边保留了 Jetty 默认行为。确认过 setSniRequired(false) 不会关闭证书与请求 Host 的匹配检查,Jetty 11 也已有这项检查。这次补了证书与 Host 不匹配时返回 400 的用例。考虑到默认关闭会放宽现有校验,建议后续有明确的 IP 直连兼容需求时,再单独讨论配置开关。

Comment thread .github/workflows/ci.yml Outdated
- name: Test with Maven
run: mvn clean install -Dmaven.test.skip=true -B -U --file pom.xml
- name: Test HTTP transport with Spring Boot BOM first
run: python3 trpc-transport/trpc-transport-http/src/test/it/boot-bom-first/run.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

用jetty 12.0.x这些测试是不是不需要了,trpc2.x版本不用考虑springboot4.x的问题

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已移除跨 Boot 版本的测试矩阵。这里保留了 Boot 3.5.16 BOM 优先的消费方回归,因为 #152 就是在应用先导入 Boot BOM、再导入 tRPC BOM 时触发的,仓库默认依赖顺序覆盖不到。JDK 17 下这组 14 项测试已全部通过。

Comment thread .github/workflows/ci.yml Outdated
cache: maven
- name: Test with Maven
run: mvn clean install -Dmaven.test.skip=true -B -U --file pom.xml
- name: Test HTTP transport with Spring Boot BOM first

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

用jetty 12.0.x这些测试是不是不需要了,trpc2.x版本不用考虑springboot4.x的问题

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

JDK 21 这边也已同步调整,只跑 Boot 3.5.16 BOM 优先这一组,14 项测试全部通过。

Comment thread .github/workflows/ci.yml Outdated
Comment on lines +35 to +36
- name: Test HTTP transport with Spring Boot 3.5.16 BOM first
run: mvn -B -ntp -f trpc-transport/trpc-transport-http/src/test/it/boot-bom-first/pom.xml test

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这两行是不是可以删了,版本一样了,是不是不用测了?还有下面的两行

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已在 4bfe681 删除 JDK 17 和 21 下单独运行 Boot 3.5.16 BOM 回归的步骤。现在 ci.yml 已与目标分支一致,两个 JDK 的常规 PR 测试均已通过。

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>

@wardseptember wardseptember Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

trpc-transport/trpc-transport-http/src/test/it 这个目录也帮删掉?其他的应该没啥问题了

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已删除 trpc-transport/trpc-transport-http/src/test/it 目录,并同步更新了 PR 描述。之前验证 Boot BOM 优先导入的 CI 记录已附在描述里,方便后续查阅。HTTP/1.1 回退和 Host 校验仍由模块常规测试覆盖。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

感谢贡献,合入了

@wardseptember
wardseptember merged commit ba797ca into trpc-group:JDK17/Springboot3 Nov 18, 2026
10 checks passed
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