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 |
|---|---|---|
|
|
@@ -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.
Contributor
Author
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. HTTP/1.1 回退已改用 Host 校验这边保留了 Jetty 默认行为。确认过 |
||
| 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,23 @@ | ||
| # 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 3.5.16'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 jobs run this consumer regression with Spring Boot | ||
| 3.5.16 after installing the tRPC artifacts. Both BOMs manage Jetty 12.0.36. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| <?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> | ||
| <configuration> | ||
| <failIfNoTests>true</failIfNoTests> | ||
| </configuration> | ||
| </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.
SpringBoot 3.5 实际管理的 12.0.x,jetty是不是用12.0.x。SpringBoot 4.x应该有下一个trpc版本兼容,trpc2.x不用兼容这个
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.
已在
3fcf823把默认 Jetty 调整为 12.0.36,与 Spring Boot 3.5.16 管理的版本一致。这个 PR 的兼容范围收回到 Boot 3,Boot 4 留给后续版本处理。