Skip to content

Feat/support springboot3.x #86

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

Open
wants to merge 14 commits into
base: JDK17/Springboot3
Choose a base branch
from
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
57 changes: 40 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-parent</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
<packaging>pom</packaging>
<description>Trpc Parent Project ${project.version}</description>
<name>trpc</name>
Expand Down Expand Up @@ -89,12 +89,12 @@
<maven.source.version>3.0.1</maven.source.version>
<maven.exec.version>3.0.1</maven.exec.version>
<maven.jar.version>3.1.2</maven.jar.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.version>3.7.0</maven.compiler.version>
<maven.gpg.version>3.1.0</maven.gpg.version>
<maven.ignore.testfailure>false</maven.ignore.testfailure>
<maven.surefire.version>2.22.0</maven.surefire.version>
<maven.surefire.version>3.1.2</maven.surefire.version>
<maven.javadoc.version>3.0.1</maven.javadoc.version>
<central-publishing-maven-plugin.version>0.7.0</central-publishing-maven-plugin.version>
<exec.maven.version>3.1.0</exec.maven.version>
Expand Down Expand Up @@ -122,29 +122,48 @@

<dependencies>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.3</version>
<scope>test</scope>
</dependency>
<!-- 保留 JUnit 4 测试 -->
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-support</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4-rule</artifactId>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.powermock</groupId>-->
<!-- <artifactId>powermock-module-junit4</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.powermock</groupId>-->
<!-- <artifactId>powermock-api-mockito2</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.powermock</groupId>-->
<!-- <artifactId>powermock-api-support</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.powermock</groupId>-->
<!-- <artifactId>powermock-module-junit4-rule</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.agent</artifactId>
<version>0.8.6</version>
<version>0.8.11</version>
<classifier>runtime</classifier>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -177,6 +196,10 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<argLine>
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
</argLine>
<testFailureIgnore>${maven.ignore.testfailure}</testFailureIgnore>
<skipTests>false</skipTests>
<systemPropertyVariables>
Expand Down Expand Up @@ -249,7 +272,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<version>0.8.8</version>
<configuration>
<skip>false</skip>
</configuration>
Expand Down
2 changes: 1 addition & 1 deletion trpc-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-parent</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>

<artifactId>trpc-admin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion trpc-admin/trpc-admin-default/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-admin</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>

<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion trpc-bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-parent</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>

<artifactId>trpc-bootstrap</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion trpc-bootstrap/trpc-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-bootstrap</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion trpc-code-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>trpc-parent</artifactId>
<groupId>com.tencent.trpc</groupId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>

<artifactId>trpc-code-generator</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion trpc-configcenter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>trpc-parent</artifactId>
<groupId>com.tencent.trpc</groupId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion trpc-configcenter/trpc-configcenter-nacos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-configcenter</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
Expand Down
2 changes: 1 addition & 1 deletion trpc-configcenter/trpc-configcenter-open-polaris/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-configcenter</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
Expand Down
2 changes: 1 addition & 1 deletion trpc-container/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-parent</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>

<artifactId>trpc-container</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion trpc-container/trpc-container-default/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-container</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>

<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion trpc-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-parent</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>

<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ public class Version {
* VERSION: Do not modify the line number of this line. If you want to modify it, be sure to change deploy.sh at
* the same time.
*/
public static final String VERSION = "v1.4.0";
public static final String VERSION = "v2.0.1";
public static final String SNAPSHOT_VERSION = VERSION + VERSION_SUFFIX;
/**
* IS_FORMAL_VERSION: Do not modify the line number of this line. If you want to modify it, be sure to change
* deploy.sh atthe same time.
*/
public static final boolean IS_FORMAL_VERSION = false;
public static final boolean IS_FORMAL_VERSION = true;

/**
* Version returns the version number of the trpc framework.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Tencent is pleased to support the open source community by making tRPC available.
*
* Copyright (C) 2023 THL A29 Limited, a Tencent company.
* Copyright (C) 2023 THL A29 Limited, a Tencent company.
* All rights reserved.
*
* If you have downloaded a copy of the tRPC source code from Tencent,
Expand All @@ -23,6 +23,7 @@
import com.tencent.trpc.core.logger.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;

/**
* JSON utility.
Expand Down Expand Up @@ -71,6 +72,26 @@ public static <T> T fromInputStream(InputStream is, Class<T> clz) {
}
}

/**
* json to Type
*
* @param is JSON input stream
* @param type the class of the Type to deserialize
* @param <T> the type of the deserialized object
* @return the deserialized object
*/
public static <T> T fromInputStream(InputStream is, Type type) {
try {
return objectMapper
.readValue(is, objectMapper.getTypeFactory().constructType(type));
} catch (Exception e) {
logger.error("object mapper readValue error:", e);
throw TRpcException.newException(ErrorCode.JSON_DESERIALIZATION_ERR, 0,
"object mapper readValue to Type error, jsonStream:%s, type:%s",
is, type.getTypeName());
}
}

/**
* JSON to Object.
*
Expand Down Expand Up @@ -126,6 +147,26 @@ public static <T> T fromJson(String json, TypeReference<T> typeReference) {
}
}

/**
* json to Type
*
* @param json JSON string
* @param type the type reference of the object to deserialize
* @param <T> the type of the deserialized object
* @return the deserialized object
*/
public static <T> T fromJson(String json, Type type) {
try {
return objectMapper
.readValue(json, objectMapper.getTypeFactory().constructType(type));
} catch (Exception e) {
logger.error("object mapper readValue error:", e);
throw TRpcException.newException(ErrorCode.JSON_DESERIALIZATION_ERR, 0,
"object mapper readValue to Type error, json:%s, type:%s", json,
type.getTypeName());
}
}

/**
* Byte arrays to Object.
*
Expand Down
2 changes: 1 addition & 1 deletion trpc-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-parent</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>

<artifactId>trpc-demo</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions trpc-demo/trpc-java-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-demo</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>
<name>trpc-demo</name>
<description>Demo project for Spring Boot</description>
Expand Down Expand Up @@ -49,7 +49,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<version>0.8.8</version>
<configuration>
<skip>true</skip>
</configuration>
Expand Down
3 changes: 2 additions & 1 deletion trpc-demo/trpc-spring-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
<modules>
<module>trpc-spring-server-demo</module>
<module>trpc-spring-client-demo</module>
<module>trpc-spring-demo-api</module>
</modules>
<packaging>pom</packaging>

<parent>
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-demo</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>

<name>trpc-spring-demo Maven Webapp</name>
Expand Down
7 changes: 6 additions & 1 deletion trpc-demo/trpc-spring-demo/trpc-spring-client-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>trpc-spring-demo</artifactId>
<groupId>com.tencent.trpc</groupId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -17,6 +17,11 @@
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-proto-http</artifactId>
</dependency>
<dependency>
<groupId>com.tencent.trpc</groupId>
<artifactId>trpc-spring-demo-api</artifactId>
<version>${parent.version}</version>
</dependency>
</dependencies>

<build>
Expand Down
Loading
Loading