Skip to content

Commit 7d78d18

Browse files
authored
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 <[email protected]> (cherry picked from commit 9152c91) * Ensure old versions of spring boot are still compatible Signed-off-by: Sergio <[email protected]> --------- Signed-off-by: champel <[email protected]> Signed-off-by: Sergio <[email protected]>
1 parent 806ddc0 commit 7d78d18

File tree

7 files changed

+66
-15
lines changed

7 files changed

+66
-15
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,28 @@ on:
1515

1616
jobs:
1717
build:
18+
name: "Build jdk:${{ matrix.java }} sb:${{ matrix.spring-boot-version }} exp:${{ matrix.experimental }}"
1819
runs-on: ubuntu-latest
20+
continue-on-error: ${{ matrix.experimental }}
1921
strategy:
22+
fail-fast: true
2023
matrix:
2124
java: [ 11, 13, 15, 16 ]
25+
spring-boot-version: [ 2.7.8 ]
26+
experimental: [ false ]
27+
include:
28+
- java: 11
29+
spring-boot-version: 2.6.14
30+
experimental: false
31+
- java: 11
32+
spring-boot-version: 2.5.7
33+
experimental: false
34+
- java: 11
35+
spring-boot-version: 2.4.0
36+
experimental: false
37+
- java: 11
38+
spring-boot-version: 2.3.6.RELEASE
39+
experimental: false
2240
env:
2341
GOVER: 1.19
2442
GOOS: linux
@@ -92,18 +110,18 @@ jobs:
92110
docker-compose -f ./sdk-tests/deploy/local-test-mongo.yml up -d
93111
docker ps
94112
- name: Clean up files
95-
run: mvn clean
113+
run: mvn clean -B
96114
- name: Build sdk
97-
run: mvn compile -q
115+
run: mvn compile -B -q
98116
- name: Unit tests
99-
run: mvn test -q
117+
run: mvn -B test -q
100118
- name: Codecov
101119
uses: codecov/[email protected]
102120
- name: Install jars
103-
run: mvn install -q
104-
- name: Integration tests
121+
run: mvn install -q -B -DskipTests
122+
- name: Integration tests using spring boot version ${{ matrix.spring-boot-version }}
105123
id: integration_tests
106-
run: mvn -f sdk-tests/pom.xml verify
124+
run: PRODUCT_SPRING_BOOT_VERSION=${{ matrix.spring-boot-version }} mvn -B -f sdk-tests/pom.xml verify
107125
- name: Upload test report for sdk
108126
uses: actions/upload-artifact@master
109127
with:
@@ -145,7 +163,7 @@ jobs:
145163
java-version: ${{ env.JDK_VER }}
146164
- name: Get pom parent version
147165
run: |
148-
PARENT_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
166+
PARENT_VERSION=$(mvn -B -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
149167
echo "PARENT_VERSION=$PARENT_VERSION" >> $GITHUB_ENV
150168
- name: Is SNAPSHOT release ?
151169
if: contains(github.ref, 'master') && contains(env.PARENT_VERSION, '-SNAPSHOT')
@@ -157,7 +175,7 @@ jobs:
157175
echo "DEPLOY_OSSRH=true" >> $GITHUB_ENV
158176
- name: Install jars
159177
if: env.DEPLOY_OSSRH == 'true'
160-
run: mvn clean install -q
178+
run: mvn clean install -B -q
161179
- name: Publish to ossrh
162180
if: env.DEPLOY_OSSRH == 'true'
163181
run: |

sdk-springboot/pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,11 @@
6868
<dependency>
6969
<groupId>org.springframework</groupId>
7070
<artifactId>spring-web</artifactId>
71-
<version>5.3.25</version>
7271
<scope>compile</scope>
7372
</dependency>
7473
<dependency>
7574
<groupId>org.springframework</groupId>
7675
<artifactId>spring-context</artifactId>
77-
<version>5.3.25</version>
7876
<scope>compile</scope>
7977
</dependency>
8078
<dependency>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
io.dapr.springboot.DaprAutoConfiguration

sdk-tests/pom.xml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@
2323
<spring-boot.version>2.7.8</spring-boot.version>
2424
</properties>
2525

26+
<dependencyManagement>
27+
<!-- Reproduce a product fixing its own spring boot version -->
28+
<dependencies>
29+
<dependency>
30+
<groupId>org.springframework.boot</groupId>
31+
<artifactId>spring-boot-dependencies</artifactId>
32+
<version>${spring-boot.version}</version>
33+
<type>pom</type>
34+
<scope>import</scope>
35+
</dependency>
36+
</dependencies>
37+
</dependencyManagement>
38+
2639
<dependencies>
2740
<dependency>
2841
<groupId>commons-cli</groupId>
@@ -102,13 +115,11 @@
102115
<dependency>
103116
<groupId>org.springframework.boot</groupId>
104117
<artifactId>spring-boot-starter-web</artifactId>
105-
<version>${spring-boot.version}</version>
106118
<scope>test</scope>
107119
</dependency>
108120
<dependency>
109121
<groupId>org.springframework.boot</groupId>
110122
<artifactId>spring-boot-autoconfigure</artifactId>
111-
<version>${spring-boot.version}</version>
112123
<scope>test</scope>
113124
</dependency>
114125
<dependency>
@@ -203,4 +214,27 @@
203214
</plugin>
204215
</plugins>
205216
</build>
217+
218+
<profiles>
219+
<profile>
220+
<id>custom-spring-boot-version</id>
221+
<activation>
222+
<property>
223+
<name>env.PRODUCT_SPRING_BOOT_VERSION</name>
224+
</property>
225+
</activation>
226+
<properties>
227+
<spring-boot.version>${env.PRODUCT_SPRING_BOOT_VERSION}</spring-boot.version>
228+
</properties>
229+
<dependencies>
230+
<dependency>
231+
<!-- Needed for dapr compatibility for spring boot versions before 2.7 -->
232+
<groupId>com.squareup.okhttp3</groupId>
233+
<artifactId>okhttp</artifactId>
234+
<version>4.9.0</version>
235+
<scope>test</scope>
236+
</dependency>
237+
</dependencies>
238+
</profile>
239+
</profiles>
206240
</project>

sdk-tests/src/test/java/io/dapr/it/AppRun.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
public class AppRun implements Stoppable {
2929

3030
private static final String APP_COMMAND =
31-
"mvn exec:java -D exec.mainClass=%s -D exec.classpathScope=test -D exec.args=\"%s\" -D %s=%s -D %s=%s";
31+
"mvn exec:java -B -D exec.mainClass=%s -D exec.classpathScope=test -D exec.args=\"%s\" -D %s=%s -D %s=%s";
3232

3333
private final DaprPorts ports;
3434

sdk-tests/src/test/java/io/dapr/it/pubsub/http/PubSubIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,8 @@ public void testLongValues() throws Exception {
755755
for (CloudEvent<ConvertToLong> message : messages) {
756756
actual.add(message.getData());
757757
}
758+
Assert.assertEquals(values, actual);
758759
}, 2000);
759-
Assert.assertEquals(values, actual);
760760
}
761761
}
762762

sdk-tests/src/test/java/io/dapr/it/tracing/http/OpenTelemetryInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import io.opentelemetry.api.OpenTelemetry;
1717
import io.opentelemetry.context.Context;
1818
import io.opentelemetry.context.propagation.TextMapPropagator;
19-
import org.jetbrains.annotations.Nullable;
19+
import javax.annotation.Nullable;
2020
import org.springframework.beans.factory.annotation.Autowired;
2121
import org.springframework.stereotype.Component;
2222
import org.springframework.web.servlet.HandlerInterceptor;

0 commit comments

Comments
 (0)