Inject autoconfiguration in the Spring Boot 3 style (#831)

* Bump from spring boot 2.3.5.RELEASE to 2.7.8

Signed-off-by: Sergio <champel@gmail.com>
(cherry picked from commit 9152c91bc1f08ecf2dd3bccf8159fd5d0500e351)

* Ensure old versions of spring boot are still compatible

Signed-off-by: Sergio <champel@gmail.com>

---------

Signed-off-by: champel <champel@gmail.com>
Signed-off-by: Sergio <champel@gmail.com>
This commit is contained in:
champel 2023-03-22 17:11:16 +01:00 committed by GitHub
parent 806ddc00bd
commit 7d78d1880f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 66 additions and 15 deletions

View File

@ -15,10 +15,28 @@ on:
jobs:
build:
name: "Build jdk:${{ matrix.java }} sb:${{ matrix.spring-boot-version }} exp:${{ matrix.experimental }}"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: true
matrix:
java: [ 11, 13, 15, 16 ]
spring-boot-version: [ 2.7.8 ]
experimental: [ false ]
include:
- java: 11
spring-boot-version: 2.6.14
experimental: false
- java: 11
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.19
GOOS: linux
@ -92,18 +110,18 @@ jobs:
docker-compose -f ./sdk-tests/deploy/local-test-mongo.yml up -d
docker ps
- name: Clean up files
run: mvn clean
run: mvn clean -B
- name: Build sdk
run: mvn compile -q
run: mvn compile -B -q
- name: Unit tests
run: mvn test -q
run: mvn -B test -q
- name: Codecov
uses: codecov/codecov-action@v3.1.1
- name: Install jars
run: mvn install -q
- name: Integration tests
run: mvn install -q -B -DskipTests
- name: Integration tests using spring boot version ${{ matrix.spring-boot-version }}
id: integration_tests
run: mvn -f sdk-tests/pom.xml verify
run: PRODUCT_SPRING_BOOT_VERSION=${{ matrix.spring-boot-version }} mvn -B -f sdk-tests/pom.xml verify
- name: Upload test report for sdk
uses: actions/upload-artifact@master
with:
@ -145,7 +163,7 @@ jobs:
java-version: ${{ env.JDK_VER }}
- name: Get pom parent version
run: |
PARENT_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
PARENT_VERSION=$(mvn -B -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
echo "PARENT_VERSION=$PARENT_VERSION" >> $GITHUB_ENV
- name: Is SNAPSHOT release ?
if: contains(github.ref, 'master') && contains(env.PARENT_VERSION, '-SNAPSHOT')
@ -157,7 +175,7 @@ jobs:
echo "DEPLOY_OSSRH=true" >> $GITHUB_ENV
- name: Install jars
if: env.DEPLOY_OSSRH == 'true'
run: mvn clean install -q
run: mvn clean install -B -q
- name: Publish to ossrh
if: env.DEPLOY_OSSRH == 'true'
run: |

View File

@ -68,13 +68,11 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.25</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.3.25</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -0,0 +1 @@
io.dapr.springboot.DaprAutoConfiguration

View File

@ -23,6 +23,19 @@
<spring-boot.version>2.7.8</spring-boot.version>
</properties>
<dependencyManagement>
<!-- Reproduce a product fixing its own spring boot version -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-cli</groupId>
@ -102,13 +115,11 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>${spring-boot.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@ -203,4 +214,27 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>custom-spring-boot-version</id>
<activation>
<property>
<name>env.PRODUCT_SPRING_BOOT_VERSION</name>
</property>
</activation>
<properties>
<spring-boot.version>${env.PRODUCT_SPRING_BOOT_VERSION}</spring-boot.version>
</properties>
<dependencies>
<dependency>
<!-- Needed for dapr compatibility for spring boot versions before 2.7 -->
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>

View File

@ -28,7 +28,7 @@ import static io.dapr.it.Retry.callWithRetry;
public class AppRun implements Stoppable {
private static final String APP_COMMAND =
"mvn exec:java -D exec.mainClass=%s -D exec.classpathScope=test -D exec.args=\"%s\" -D %s=%s -D %s=%s";
"mvn exec:java -B -D exec.mainClass=%s -D exec.classpathScope=test -D exec.args=\"%s\" -D %s=%s -D %s=%s";
private final DaprPorts ports;

View File

@ -755,8 +755,8 @@ public class PubSubIT extends BaseIT {
for (CloudEvent<ConvertToLong> message : messages) {
actual.add(message.getData());
}
Assert.assertEquals(values, actual);
}, 2000);
Assert.assertEquals(values, actual);
}
}

View File

@ -16,7 +16,7 @@ package io.dapr.it.tracing.http;
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.propagation.TextMapPropagator;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;