Repository navigation
transport: support Jetty 12 with Spring Boot BOM precedence #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: JDK17/Springboot3
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,8 @@ jobs: | |
| 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 | ||
| run: python3 trpc-transport/trpc-transport-http/src/test/it/boot-bom-first/run.py | ||
| JDK21: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
|
|
@@ -48,6 +50,8 @@ jobs: | |
| 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 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 用jetty 12.0.x这些测试是不是不需要了,trpc2.x版本不用考虑springboot4.x的问题 |
||
| run: python3 trpc-transport/trpc-transport-http/src/test/it/boot-bom-first/run.py | ||
| JDK17-master: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,8 +96,7 @@ | |
| <jakarta.xml.bind-api.version>4.0.2</jakarta.xml.bind-api.version> | ||
| <javax.ws.rs.version>2.1.1</javax.ws.rs.version> | ||
| <javax.validation.version>2.0.1.Final</javax.validation.version> | ||
| <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> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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不用兼容这个 |
||
| <jprotobuf.version>2.4.14</jprotobuf.version> | ||
| <junit.version>5.12.2</junit.version> | ||
|
|
@@ -577,85 +576,18 @@ | |
| <version>${javax.servlet-api.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>jetty-server</artifactId> | ||
| <groupId>org.eclipse.jetty</groupId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>jetty-servlet</artifactId> | ||
| <groupId>org.eclipse.jetty</groupId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>jetty-io</artifactId> | ||
| <groupId>org.eclipse.jetty</groupId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>jetty-util</artifactId> | ||
| <groupId>org.eclipse.jetty</groupId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>jetty-util-ajax</artifactId> | ||
| <groupId>org.eclipse.jetty</groupId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>jetty-security</artifactId> | ||
| <groupId>org.eclipse.jetty</groupId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>jetty-http</artifactId> | ||
| <groupId>org.eclipse.jetty</groupId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>http2-server</artifactId> | ||
| <groupId>org.eclipse.jetty.http2</groupId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>http2-common</artifactId> | ||
| <groupId>org.eclipse.jetty.http2</groupId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>http2-hpack</artifactId> | ||
| <groupId>org.eclipse.jetty.http2</groupId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>jetty-alpn-server</artifactId> | ||
| <groupId>org.eclipse.jetty</groupId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>jetty-alpn-conscrypt-server</artifactId> | ||
| <groupId>org.eclipse.jetty</groupId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>jetty-alpn-java-server</artifactId> | ||
| <groupId>org.eclipse.jetty</groupId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>jetty-alpn-openjdk8-server</artifactId> | ||
| <groupId>org.eclipse.jetty</groupId> | ||
| <artifactId>jetty-bom</artifactId> | ||
| <version>${jetty.version}</version> | ||
| <type>pom</type> | ||
| <scope>import</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.eclipse.jetty</groupId> | ||
| <artifactId>jetty-webapp</artifactId> | ||
| <groupId>org.eclipse.jetty.ee10</groupId> | ||
| <artifactId>jetty-ee10-bom</artifactId> | ||
| <version>${jetty.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <artifactId>alpn-boot</artifactId> | ||
| <groupId>org.mortbay.jetty.alpn</groupId> | ||
| <scope>runtime</scope> | ||
| <version>${jetty.alpn.boot.version}</version> | ||
| <type>pom</type> | ||
| <scope>import</scope> | ||
| </dependency> | ||
| <!--javassist opensource dependencies--> | ||
| <dependency> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,10 +21,9 @@ | |
| import com.tencent.trpc.core.rpc.def.DefProviderInvoker; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| import com.tencent.trpc.core.utils.NetUtils; | ||
| import com.tencent.trpc.proto.standard.common.TRPCProtocol; | ||
| import jakarta.servlet.http.HttpServletRequest; | ||
| import jakarta.servlet.http.HttpServletResponse; | ||
| import javax.ws.rs.HttpMethod; | ||
| import org.eclipse.jetty.server.HttpChannel; | ||
| import org.eclipse.jetty.server.Request; | ||
| import org.eclipse.jetty.server.Response; | ||
| import org.eclipse.jetty.server.Server; | ||
| import org.eclipse.jetty.server.ServerConnector; | ||
| import org.eclipse.jetty.util.thread.QueuedThreadPool; | ||
|
|
@@ -69,9 +68,8 @@ | |
| connector.setAcceptQueueSize(60); | ||
| server.addConnector(connector); | ||
|
|
||
| HttpChannel httpChannel = org.mockito.Mockito.mock(HttpChannel.class); | ||
| Request request = org.mockito.Mockito.mock(Request.class); | ||
| Response response = org.mockito.Mockito.mock(Response.class); | ||
| HttpServletRequest request = org.mockito.Mockito.mock(HttpServletRequest.class); | ||
| HttpServletResponse response = org.mockito.Mockito.mock(HttpServletResponse.class); | ||
|
Check warning on line 72 in trpc-proto/trpc-proto-http/src/test/java/com/tencent/trpc/proto/http/server/DefaultHttpExecutorTest.java
|
||
|
|
||
| org.mockito.Mockito.when(request.getMethod()).thenReturn(HttpMethod.GET); | ||
| org.mockito.Mockito.when(request.getPathInfo()).thenReturn("/trpc.test.rpc.Hello/sayHello"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Spring Boot BOM compatibility regression | ||
|
|
||
| This consumer reproduces the dependency-management order from issue | ||
| [#152](https://github.com/trpc-group/trpc-java/issues/152): Spring Boot's BOM precedes | ||
| tRPC's BOM. It reuses the transport tests against the installed tRPC artifacts, | ||
| covering HTTP/1.1, HTTPS, h2c, h2 with ALPN, request bodies and asynchronous Servlet | ||
| responses. All server sockets bind explicitly to `127.0.0.1`. | ||
|
|
||
| Run from the repository root with JDK 17 or 21: | ||
|
|
||
| ```sh | ||
| mvn -B -ntp -pl trpc-dependencies/trpc-dependencies-bom,trpc-dependencies/trpc-bom,trpc-transport/trpc-transport-http -am -Dmaven.test.skip=true install | ||
| mvn -B -ntp -f trpc-transport/trpc-transport-http/src/test/it/boot-bom-first/pom.xml test | ||
| ``` | ||
|
|
||
| To test the released implementation as a negative control, add | ||
| `-Dtrpc.version=2.0.5` to the second command. With Spring Boot 3.5.16 this mixes | ||
| Jetty 12 core artifacts with Jetty 11 Servlet/HTTP2 artifacts and fails during | ||
| server initialization. The fixed snapshot uses Jetty 12 core and EE10 BOMs, | ||
| EE10 Servlet coordinates, and the renamed HTTP/2 artifacts. | ||
|
|
||
| The JDK 17 and JDK 21 Maven install CI jobs run the compatibility matrix after | ||
| installing the reactor artifacts: | ||
|
|
||
| ```sh | ||
| python3 trpc-transport/trpc-transport-http/src/test/it/boot-bom-first/run.py | ||
| ``` | ||
|
|
||
| The runner reads the current `springboot.version` from tRPC's dependency BOM and | ||
| Maven Central's release metadata. It selects every published stable patch of | ||
| that baseline's minor line and all later stable versions, plus the latest patch | ||
| of the two preceding minor lines within the same major. For the 3.5.0 baseline, | ||
| this covers every 3.5.x patch and | ||
| later stable releases, with 3.4.x and 3.3.x as backward compatibility samples. | ||
| Milestones, release candidates and snapshots are excluded. Boot 3.1 and Jetty 11 | ||
| are outside this support range; their incompatibility is not a release blocker. | ||
| New stable versions are picked up on subsequent CI runs, rather than assumed | ||
| compatible in advance. | ||
|
|
||
| Jetty core and EE10 BOMs default to the 12.1 line. Boot 3.5's BOM manages both | ||
| core and EE10 artifacts, selecting its aligned 12.0.x versions. Boot 4 manages | ||
| EE11 instead of EE10, so tRPC must provide a 12.1-compatible EE10 default to | ||
| avoid mixing EE10 12.0 with a 12.1 core. The Servlet-based tRPC executor contract | ||
| is unchanged. These tests cover the HTTP transport under each BOM, not the full | ||
| Spring Boot starter, application auto-configuration or gateway application. | ||
|
|
||
| Each version runs in a separate Maven invocation. Results and dependency trees | ||
| are saved under the repository's `target/jetty-boot-compatibility/` directory. | ||
| The normal reactor `test` command does not invoke this fixture. Additional | ||
| arguments to `run.py` are passed to Maven, so isolated settings and repository | ||
| options can be reused. For a single version, use the standalone POM command | ||
| above with `-Dspring-boot.version=...`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>com.tencent.trpc.tests</groupId> | ||
| <artifactId>jetty-boot-bom-first</artifactId> | ||
| <version>1.0-SNAPSHOT</version> | ||
|
|
||
| <properties> | ||
| <trpc.version>2.0.5-SNAPSHOT</trpc.version> | ||
| <spring-boot.version>3.5.16</spring-boot.version> | ||
| <maven.compiler.release>17</maven.compiler.release> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| </properties> | ||
|
|
||
| <!-- Model an application that gives Spring Boot's dependency management priority. --> | ||
| <dependencyManagement> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-dependencies</artifactId> | ||
| <version>${spring-boot.version}</version> | ||
| <type>pom</type> | ||
| <scope>import</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.tencent.trpc</groupId> | ||
| <artifactId>trpc-dependencies-bom</artifactId> | ||
| <version>${trpc.version}</version> | ||
| <type>pom</type> | ||
| <scope>import</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| </dependencyManagement> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.tencent.trpc</groupId> | ||
| <artifactId>trpc-transport-http</artifactId> | ||
| <version>${trpc.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.httpcomponents.core5</groupId> | ||
| <artifactId>httpcore5-h2</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.httpcomponents.client5</groupId> | ||
| <artifactId>httpclient5</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.httpcomponents</groupId> | ||
| <artifactId>httpcore</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.httpcomponents</groupId> | ||
| <artifactId>httpclient</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.mockito</groupId> | ||
| <artifactId>mockito-core</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <!-- Exercise the same transport contract with the consumer's resolved dependencies. --> | ||
| <testSourceDirectory>${project.basedir}/../../java</testSourceDirectory> | ||
| <testResources> | ||
| <testResource> | ||
| <directory>${project.basedir}/../../resources</directory> | ||
| </testResource> | ||
| </testResources> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-compiler-plugin</artifactId> | ||
| <version>3.11.0</version> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-surefire-plugin</artifactId> | ||
| <version>3.0.0-M9</version> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |

There was a problem hiding this comment.
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的问题