mirror of https://github.com/dapr/java-sdk.git
Add JDK17 and springboot 3.0 support (#975)
* add support for java17 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * upgrade spotbugs-maven-plugin version to support jdk17 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * add clean before install Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * add clean in mvn command Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * rollback spotbugs-maven-plugin version to 4.1.4 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * add jdk17 in build Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * update to support jdk17 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * remove jdk versions earlier than jdk17 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * remove springboot 2.3 and 2.4 because they don't support jdk17 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * update to jdk17 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * update maven plugin versions to support jdk17 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * temporarily ignoring checking after upgrade to new spotbugs version to support jdk17 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * use the same version of maven-failsafe-plugin Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * hard code maven-failsafe-plugin version to 3.2.2 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * set sourceDirectory of checkstyle plugin to only check the sources directory, not test source and generated source Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * set release to jdk17 in examples subproject Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * update to springboot 3.0 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * add springboot 3.0.13 in springboot version matrics Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * upgrade to springboot 3.0.13 in sdk-tests Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * remove Nullable annotation Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * force opentelemetry-sdk-metrics dependencies to be version 0.14.0 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * jakarta.servlet is needed for dapr compatibility for spring boot versions before 3.0 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * update code to run with jakarta.servlet and javax.servlet Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * update jakarta.annotation to latest version Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * add javax.annotation Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * trigger ci Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * revert back to using 3.0 version of the github action Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * revert back to use jdk11 for vallidate Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * jdk17 is required for vallidate Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * trigger ci Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * use jdk17 to validate Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * remove java8 support Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * use jdk11 to test springboot2.x and jdk17 to test springboot3.0 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * rollback to jdk17 to test for springboot2.x Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * rename springboot30 to springboot3 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * skip mvn test in mvn install Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * add more exclude for spotbugs Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * add more exclude for spotbugs Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * set java source and target to 17 in sdk-tests Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * rollback root pom.xml to remove sdk-tests module Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * exclude logback to avoid conflicts Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * replace ctx.getLogger() with sysout Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * update stdout line according to source code Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * rollback validate line, replace ctx.getLogger() with system out in wofklow Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * rollback example code for subworkflow Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * print ctx.getLogger() and instanceId for debug Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * rollback to not exclude logback Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * add slf4j as compile dependency and upgrade its version to 2.0.9 Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * print the logger implementation class Signed-off-by: Sky Ao <aoxiaojian@gmail.com> * remove debug code Signed-off-by: Sky Ao <aoxiaojian@gmail.com> --------- Signed-off-by: Sky Ao <aoxiaojian@gmail.com> Co-authored-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com>
This commit is contained in:
parent
4a7b9856ba
commit
7eb24ffc69
|
@ -21,22 +21,19 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java: [ 11, 13, 15, 16 ]
|
||||
spring-boot-version: [ 2.7.8 ]
|
||||
java: [ 17 ]
|
||||
spring-boot-version: [ 3.0.13 ]
|
||||
experimental: [ false ]
|
||||
include:
|
||||
- java: 11
|
||||
- java: 17
|
||||
spring-boot-version: 2.7.8
|
||||
experimental: false
|
||||
- java: 17
|
||||
spring-boot-version: 2.6.14
|
||||
experimental: false
|
||||
- java: 11
|
||||
- java: 17
|
||||
spring-boot-version: 2.5.7
|
||||
experimental: false
|
||||
- java: 11
|
||||
spring-boot-version: 2.4.0
|
||||
experimental: false
|
||||
- java: 11
|
||||
spring-boot-version: 2.3.6.RELEASE
|
||||
experimental: false
|
||||
env:
|
||||
GOVER: "1.20"
|
||||
GOOS: linux
|
||||
|
@ -152,7 +149,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
env:
|
||||
JDK_VER: 11
|
||||
JDK_VER: 17
|
||||
OSSRH_USER_TOKEN: ${{ secrets.OSSRH_USER_TOKEN }}
|
||||
OSSRH_PWD_TOKEN: ${{ secrets.OSSRH_PWD_TOKEN }}
|
||||
GPG_KEY: ${{ secrets.GPG_KEY }}
|
||||
|
@ -178,7 +175,7 @@ jobs:
|
|||
echo "DEPLOY_OSSRH=true" >> $GITHUB_ENV
|
||||
- name: Install jars
|
||||
if: env.DEPLOY_OSSRH == 'true'
|
||||
run: ./mvnw clean install -B -q
|
||||
run: ./mvnw install -B -q
|
||||
- name: Publish to ossrh
|
||||
if: env.DEPLOY_OSSRH == 'true'
|
||||
run: |
|
||||
|
|
|
@ -30,7 +30,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false # Keep running if one leg fails.
|
||||
matrix:
|
||||
java: [ 11, 13, 15, 16 ]
|
||||
java: [ 17 ]
|
||||
env:
|
||||
GOVER: "1.20"
|
||||
GOOS: linux
|
||||
|
|
|
@ -18,12 +18,13 @@
|
|||
<properties>
|
||||
<protobuf.output.directory>${project.build.directory}/generated-sources</protobuf.output.directory>
|
||||
<protobuf.input.directory>${project.basedir}/proto</protobuf.input.directory>
|
||||
<java.version>11</java.version>
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<maven.deploy.skip>true</maven.deploy.skip>
|
||||
<spotbugs.fail>false</spotbugs.fail>
|
||||
<opentelemetry.version>0.14.0</opentelemetry.version>
|
||||
<springboot.version>3.0.13</springboot.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -66,12 +67,12 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>2.7.8</version>
|
||||
<version>${springboot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
<version>2.7.8</version>
|
||||
<version>${springboot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.jsonpath</groupId>
|
||||
|
@ -111,7 +112,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.dapr</groupId>
|
||||
<artifactId>dapr-sdk-springboot</artifactId>
|
||||
<artifactId>dapr-sdk-springboot3</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -134,6 +135,11 @@
|
|||
<artifactId>retry4j</artifactId>
|
||||
<version>0.15.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -176,7 +182,7 @@
|
|||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<release>11</release>
|
||||
<release>${java.version}</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -212,6 +218,14 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Skip checkstyle for auto-generated code -->
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -22,9 +22,9 @@ import org.springframework.stereotype.Component;
|
|||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.DispatcherType;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.DispatcherType;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.Collections;
|
||||
|
||||
@Component
|
||||
|
|
40
pom.xml
40
pom.xml
|
@ -22,8 +22,8 @@
|
|||
<maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version>
|
||||
<maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
|
||||
<maven-deploy-plugin.version>2.7</maven-deploy-plugin.version>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<maven.deploy.skip>true</maven.deploy.skip>
|
||||
<!--
|
||||
manually declare durabletask-client's jackson dependencies for workflows sdk
|
||||
|
@ -32,13 +32,11 @@
|
|||
-->
|
||||
<jackson.version>2.12.3</jackson.version>
|
||||
<gpg.skip>true</gpg.skip>
|
||||
<spotbugs.version>4.0.0-RC1</spotbugs.version>
|
||||
<spotbugs.fail>true</spotbugs.fail>
|
||||
<spotbugs.exclude.filter.file>../spotbugs-exclude.xml</spotbugs.exclude.filter.file>
|
||||
<springboot.version>2.7.8</springboot.version>
|
||||
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED</argLine>
|
||||
<failsafe.version>3.1.2</failsafe.version>
|
||||
<surefire.version>3.1.2</surefire.version>
|
||||
<failsafe.version>3.2.2</failsafe.version>
|
||||
<surefire.version>3.2.2</surefire.version>
|
||||
<junit-bom.version>5.7.2</junit-bom.version>
|
||||
</properties>
|
||||
|
||||
|
@ -60,6 +58,11 @@
|
|||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>2.0.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-bom</artifactId>
|
||||
|
@ -120,7 +123,7 @@
|
|||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.6</version>
|
||||
<version>0.8.11</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
@ -132,7 +135,7 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>animal-sniffer-maven-plugin</artifactId>
|
||||
<version>1.20</version>
|
||||
<version>1.23</version>
|
||||
<configuration>
|
||||
<signature>
|
||||
<groupId>org.codehaus.mojo.signature</groupId>
|
||||
|
@ -154,7 +157,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
|
@ -175,7 +178,7 @@
|
|||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.6.8</version>
|
||||
<version>1.6.13</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
|
@ -186,7 +189,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.3.1</version>
|
||||
<configuration>
|
||||
<configLocation>checkstyle.xml</configLocation>
|
||||
<encoding>UTF-8</encoding>
|
||||
|
@ -219,15 +222,7 @@
|
|||
<plugin>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs-maven-plugin</artifactId>
|
||||
<version>4.1.4</version>
|
||||
<dependencies>
|
||||
<!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
|
||||
<dependency>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs</artifactId>
|
||||
<version>${spotbugs.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<version>4.8.2.0</version>
|
||||
<configuration>
|
||||
<excludeFilterFile>${spotbugs.exclude.filter.file}</excludeFilterFile>
|
||||
<failOnError>${spotbugs.fail}</failOnError>
|
||||
|
@ -316,7 +311,12 @@
|
|||
<module>sdk-actors</module>
|
||||
<module>sdk-workflows</module>
|
||||
<module>sdk-springboot</module>
|
||||
<module>sdk-springboot3</module>
|
||||
<module>examples</module>
|
||||
<!-- don't add sdk-tests to the build,
|
||||
it's only used for CI testing by github action
|
||||
<module>sdk-tests</module>
|
||||
-->
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.6</version>
|
||||
<version>0.8.11</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-prepare-agent</id>
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.6</version>
|
||||
<version>0.8.11</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-prepare-agent</id>
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
<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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>io.dapr</groupId>
|
||||
<artifactId>dapr-sdk-parent</artifactId>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>dapr-sdk-springboot3</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<name>dapr-sdk-springboot3</name>
|
||||
<description>SDK extension for Springboot 3.0</description>
|
||||
|
||||
<properties>
|
||||
<maven.deploy.skip>false</maven.deploy.skip>
|
||||
<springboot.version>3.0.13</springboot.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.dapr</groupId>
|
||||
<artifactId>dapr-sdk-springboot</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.gmazzo</groupId>
|
||||
<artifactId>okhttp-mock</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-params</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.deploy.skip>true</maven.deploy.skip>
|
||||
<dapr.sdk.version>1.11.0-SNAPSHOT</dapr.sdk.version>
|
||||
<protobuf.output.directory>${project.build.directory}/generated-sources</protobuf.output.directory>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<grpc.version>1.59.0</grpc.version>
|
||||
<protobuf.version>3.17.3</protobuf.version>
|
||||
<opentelemetry.version>0.14.0</opentelemetry.version>
|
||||
<spring-boot.version>2.7.8</spring-boot.version>
|
||||
<spring-boot.version>3.0.13</spring-boot.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
|
@ -80,6 +80,31 @@
|
|||
<artifactId>opentelemetry-sdk</artifactId>
|
||||
<version>${opentelemetry.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.opentelemetry</groupId>
|
||||
<artifactId>opentelemetry-api</artifactId>
|
||||
<version>${opentelemetry.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.opentelemetry</groupId>
|
||||
<artifactId>opentelemetry-context</artifactId>
|
||||
<version>${opentelemetry.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.opentelemetry</groupId>
|
||||
<artifactId>opentelemetry-sdk-common</artifactId>
|
||||
<version>${opentelemetry.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.opentelemetry</groupId>
|
||||
<artifactId>opentelemetry-sdk-trace</artifactId>
|
||||
<version>${opentelemetry.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.opentelemetry</groupId>
|
||||
<artifactId>opentelemetry-sdk-metrics</artifactId>
|
||||
<version>${opentelemetry.version}-alpha</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.opentelemetry</groupId>
|
||||
<artifactId>opentelemetry-exporter-logging</artifactId>
|
||||
|
@ -104,9 +129,19 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.dapr</groupId>
|
||||
<artifactId>dapr-sdk-springboot</artifactId>
|
||||
<artifactId>dapr-sdk-springboot3</artifactId>
|
||||
<version>${dapr.sdk.version}</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
|
@ -149,7 +184,13 @@
|
|||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
<version>1.3.5</version>
|
||||
<version>2.1.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>1.3.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -157,6 +198,20 @@
|
|||
<artifactId>toxiproxy-java</artifactId>
|
||||
<version>2.1.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- jakarta.servlet is needed for dapr compatibility for spring boot versions before 3.0 -->
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>6.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- javax.servlet is needed for dapr compatibility for spring boot versions before 3.0 -->
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -209,7 +264,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<version>3.2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
|
@ -16,15 +16,14 @@ package io.dapr.it.tracing.http;
|
|||
import io.opentelemetry.api.OpenTelemetry;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.context.propagation.TextMapPropagator;
|
||||
import javax.annotation.Nullable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.DispatcherType;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.DispatcherType;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.Collections;
|
||||
|
||||
@Component
|
||||
|
@ -33,21 +32,20 @@ public class OpenTelemetryInterceptor implements HandlerInterceptor {
|
|||
@Autowired
|
||||
private OpenTelemetry openTelemetry;
|
||||
|
||||
private static final TextMapPropagator.Getter<HttpServletRequest> HTTP_SERVLET_REQUEST_GETTER =
|
||||
// implmentation for springboot 3.0, which uses jakarta.servlet instead of javax.servlet
|
||||
private static final TextMapPropagator.Getter<HttpServletRequest> JAKARTA_HTTP_SERVLET_REQUEST_GETTER =
|
||||
new TextMapPropagator.Getter<>() {
|
||||
@Override
|
||||
public Iterable<String> keys(HttpServletRequest carrier) {
|
||||
return Collections.list(carrier.getHeaderNames());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String get(@Nullable HttpServletRequest carrier, String key) {
|
||||
public String get(HttpServletRequest carrier, String key) {
|
||||
return carrier.getHeader(key);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean preHandle(
|
||||
HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||
final TextMapPropagator textFormat = openTelemetry.getPropagators().getTextMapPropagator();
|
||||
|
@ -57,16 +55,50 @@ public class OpenTelemetryInterceptor implements HandlerInterceptor {
|
|||
return true;
|
||||
}
|
||||
|
||||
Context context = textFormat.extract(Context.current(), request, HTTP_SERVLET_REQUEST_GETTER);
|
||||
Context context = textFormat.extract(Context.current(), request, JAKARTA_HTTP_SERVLET_REQUEST_GETTER);
|
||||
request.setAttribute("opentelemetry-context", context);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(
|
||||
HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||
ModelAndView modelAndView) {
|
||||
// There is no global context to be changed in post handle since it is done in preHandle on a new call.
|
||||
}
|
||||
|
||||
|
||||
// implmentation for springboot 3.0, which uses jakarta.servlet instead of javax.servlet
|
||||
private static final TextMapPropagator.Getter<javax.servlet.http.HttpServletRequest> JAVA_HTTP_SERVLET_REQUEST_GETTER =
|
||||
new TextMapPropagator.Getter<>() {
|
||||
@Override
|
||||
public Iterable<String> keys(javax.servlet.http.HttpServletRequest carrier) {
|
||||
return Collections.list(carrier.getHeaderNames());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(javax.servlet.http.HttpServletRequest carrier, String key) {
|
||||
return carrier.getHeader(key);
|
||||
}
|
||||
};
|
||||
|
||||
public boolean preHandle(
|
||||
javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler) {
|
||||
final TextMapPropagator textFormat = openTelemetry.getPropagators().getTextMapPropagator();
|
||||
// preHandle is called twice for asynchronous request. For more information, read:
|
||||
// https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/AsyncHandlerInterceptor.html
|
||||
if (request.getDispatcherType() == javax.servlet.DispatcherType.ASYNC) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Context context = textFormat.extract(Context.current(), request, JAVA_HTTP_SERVLET_REQUEST_GETTER);
|
||||
request.setAttribute("opentelemetry-context", context);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void postHandle(
|
||||
javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler,
|
||||
ModelAndView modelAndView) {
|
||||
// There is no global context to be changed in post handle since it is done in preHandle on a new call.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.8</version>
|
||||
<version>0.8.11</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-prepare-agent</id>
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
|
@ -173,7 +177,7 @@
|
|||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.6</version>
|
||||
<version>0.8.11</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-prepare-agent</id>
|
||||
|
|
|
@ -3,4 +3,52 @@
|
|||
<Match>
|
||||
<Package name="~io\.dapr\.examples.*"/>
|
||||
</Match>
|
||||
|
||||
<!--Temporarily ignoring checking after upgrade to new spotbugs version-->
|
||||
<Match>
|
||||
<Package name="~io\.dapr.*"/>
|
||||
<Bug pattern="EI_EXPOSE_REP"/>
|
||||
</Match>
|
||||
|
||||
<!--Temporarily ignoring checking after upgrade to new spotbugs version-->
|
||||
<Match>
|
||||
<Package name="~io\.dapr.*"/>
|
||||
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
|
||||
</Match>
|
||||
|
||||
<!--Temporarily ignoring checking after upgrade to new spotbugs version-->
|
||||
<Match>
|
||||
<Package name="~io\.dapr.*"/>
|
||||
<Bug pattern="SS_SHOULD_BE_STATIC"/>
|
||||
</Match>
|
||||
|
||||
<!--Temporarily ignoring checking after upgrade to new spotbugs version-->
|
||||
<Match>
|
||||
<Package name="~io\.dapr.*"/>
|
||||
<Bug pattern="EI_EXPOSE_REP"/>
|
||||
</Match>
|
||||
|
||||
<!--Temporarily ignoring checking after upgrade to new spotbugs version-->
|
||||
<Match>
|
||||
<Package name="~io\.dapr.*"/>
|
||||
<Bug pattern="EI_EXPOSE_REP2"/>
|
||||
</Match>
|
||||
|
||||
<!--Temporarily ignoring checking after upgrade to new spotbugs version-->
|
||||
<Match>
|
||||
<Package name="~io\.dapr.*"/>
|
||||
<Bug pattern="UUF_UNUSED_FIELD"/>
|
||||
</Match>
|
||||
|
||||
<!--Temporarily ignoring checking after upgrade to new spotbugs version-->
|
||||
<Match>
|
||||
<Package name="~io\.dapr.*"/>
|
||||
<Bug pattern="UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD"/>
|
||||
</Match>
|
||||
|
||||
<!--Temporarily ignoring checking after upgrade to new spotbugs version-->
|
||||
<Match>
|
||||
<Package name="~io\.dapr.*"/>
|
||||
<Bug pattern="NP_UNWRITTEN_FIELD"/>
|
||||
</Match>
|
||||
</FindBugsFilter>
|
Loading…
Reference in New Issue