Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

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的问题

JDK21:
runs-on: ubuntu-latest
steps:
Expand All @@ -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

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的问题

run: python3 trpc-transport/trpc-transport-http/src/test/it/boot-bom-first/run.py
JDK17-master:
runs-on: ubuntu-latest
steps:
Expand Down
84 changes: 8 additions & 76 deletions trpc-dependencies/trpc-dependencies-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

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不用兼容这个

<jprotobuf.version>2.4.14</jprotobuf.version>
<junit.version>5.12.2</junit.version>
Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 这两个问题帮改一下?

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;
Expand Down Expand Up @@ -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

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] reported by reviewdog 🐶 变量'response'声明及第一次使用距离6行(最多:3 行)。若需要存储该变量的值,请将其声明为final的(方法调用前声明以避免副作用影响原值)。 Raw Output: /github/workspace/trpc-proto/trpc-proto-http/src/test/java/com/tencent/trpc/proto/http/server/DefaultHttpExecutorTest.java:72:9: warning: 变量'response'声明及第一次使用距离6行(最多:3 行)。若需要存储该变量的值,请将其声明为final的(方法调用前声明以避免副作用影响原值)。 (com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck)

org.mockito.Mockito.when(request.getMethod()).thenReturn(HttpMethod.GET);
org.mockito.Mockito.when(request.getPathInfo()).thenReturn("/trpc.test.rpc.Hello/sayHello");
Expand Down
6 changes: 3 additions & 3 deletions trpc-spring-support/trpc-spring-cloud-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<artifactId>trpc-rpc-support</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
<groupId>com.tencent.trpc</groupId>
Expand All @@ -64,4 +64,4 @@
</dependency>
</dependencies>

</project>
</project>
11 changes: 3 additions & 8 deletions trpc-transport/trpc-transport-http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,17 @@
<artifactId>jetty-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
<artifactId>http2-server</artifactId>
<artifactId>jetty-http2-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-server</artifactId>
</dependency>
<dependency>
<groupId>org.mortbay.jetty.alpn</groupId>
<artifactId>alpn-boot</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-conscrypt-server</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import com.tencent.trpc.transport.http.ExecutorDispatcher;
import com.tencent.trpc.transport.http.HttpExecutor;
import com.tencent.trpc.transport.http.common.ServletManager;
import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
import org.eclipse.jetty.ee10.servlet.ServletHandler;
import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.thread.QueuedThreadPool;

/**
Expand Down Expand Up @@ -120,9 +120,10 @@ private ServletContextHandler getServletContextHandler(Server server) {
servletHandler.addServletWithMapping(ExecutorDispatcher.class, "/*");
servletHolder.setAsyncSupported(true);
servletHolder.setInitOrder(1);
ServletContextHandler context =
new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
context.setServletHandler(servletHandler);
server.setHandler(context);
return context;
}

Expand Down
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>
Loading
Loading