mirror of https://github.com/dapr/java-sdk.git
				
				
				
			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:
		
							parent
							
								
									806ddc00bd
								
							
						
					
					
						commit
						7d78d1880f
					
				|  | @ -15,10 +15,28 @@ on: | ||||||
| 
 | 
 | ||||||
| jobs: | jobs: | ||||||
|   build: |   build: | ||||||
|  |     name: "Build jdk:${{ matrix.java }} sb:${{ matrix.spring-boot-version }} exp:${{ matrix.experimental }}" | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|  |     continue-on-error: ${{ matrix.experimental }} | ||||||
|     strategy: |     strategy: | ||||||
|  |       fail-fast: true | ||||||
|       matrix: |       matrix: | ||||||
|         java: [ 11, 13, 15, 16 ] |         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: |     env: | ||||||
|       GOVER: 1.19 |       GOVER: 1.19 | ||||||
|       GOOS: linux |       GOOS: linux | ||||||
|  | @ -92,18 +110,18 @@ jobs: | ||||||
|         docker-compose -f ./sdk-tests/deploy/local-test-mongo.yml up -d |         docker-compose -f ./sdk-tests/deploy/local-test-mongo.yml up -d | ||||||
|         docker ps |         docker ps | ||||||
|     - name: Clean up files |     - name: Clean up files | ||||||
|       run: mvn clean |       run: mvn clean -B | ||||||
|     - name: Build sdk |     - name: Build sdk | ||||||
|       run: mvn compile -q |       run: mvn compile -B -q | ||||||
|     - name: Unit tests |     - name: Unit tests | ||||||
|       run: mvn test -q |       run: mvn -B test -q | ||||||
|     - name: Codecov |     - name: Codecov | ||||||
|       uses: codecov/codecov-action@v3.1.1 |       uses: codecov/codecov-action@v3.1.1 | ||||||
|     - name: Install jars |     - name: Install jars | ||||||
|       run: mvn install  -q |       run: mvn install -q -B -DskipTests | ||||||
|     - name: Integration tests |     - name: Integration tests using spring boot version ${{ matrix.spring-boot-version }} | ||||||
|       id: integration_tests |       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 |     - name: Upload test report for sdk | ||||||
|       uses: actions/upload-artifact@master |       uses: actions/upload-artifact@master | ||||||
|       with: |       with: | ||||||
|  | @ -145,7 +163,7 @@ jobs: | ||||||
|           java-version: ${{ env.JDK_VER }} |           java-version: ${{ env.JDK_VER }} | ||||||
|       - name: Get pom parent version |       - name: Get pom parent version | ||||||
|         run: | |         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 |           echo "PARENT_VERSION=$PARENT_VERSION" >> $GITHUB_ENV | ||||||
|       - name: Is SNAPSHOT release ? |       - name: Is SNAPSHOT release ? | ||||||
|         if: contains(github.ref, 'master') && contains(env.PARENT_VERSION, '-SNAPSHOT') |         if: contains(github.ref, 'master') && contains(env.PARENT_VERSION, '-SNAPSHOT') | ||||||
|  | @ -157,7 +175,7 @@ jobs: | ||||||
|           echo "DEPLOY_OSSRH=true" >> $GITHUB_ENV |           echo "DEPLOY_OSSRH=true" >> $GITHUB_ENV | ||||||
|       - name: Install jars |       - name: Install jars | ||||||
|         if: env.DEPLOY_OSSRH == 'true' |         if: env.DEPLOY_OSSRH == 'true' | ||||||
|         run: mvn clean install -q |         run: mvn clean install -B -q | ||||||
|       - name: Publish to ossrh |       - name: Publish to ossrh | ||||||
|         if: env.DEPLOY_OSSRH == 'true' |         if: env.DEPLOY_OSSRH == 'true' | ||||||
|         run: | |         run: | | ||||||
|  |  | ||||||
|  | @ -68,13 +68,11 @@ | ||||||
|     <dependency> |     <dependency> | ||||||
|       <groupId>org.springframework</groupId> |       <groupId>org.springframework</groupId> | ||||||
|       <artifactId>spring-web</artifactId> |       <artifactId>spring-web</artifactId> | ||||||
|       <version>5.3.25</version> |  | ||||||
|       <scope>compile</scope> |       <scope>compile</scope> | ||||||
|     </dependency> |     </dependency> | ||||||
|     <dependency> |     <dependency> | ||||||
|       <groupId>org.springframework</groupId> |       <groupId>org.springframework</groupId> | ||||||
|       <artifactId>spring-context</artifactId> |       <artifactId>spring-context</artifactId> | ||||||
|       <version>5.3.25</version> |  | ||||||
|       <scope>compile</scope> |       <scope>compile</scope> | ||||||
|     </dependency> |     </dependency> | ||||||
|     <dependency> |     <dependency> | ||||||
|  |  | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | io.dapr.springboot.DaprAutoConfiguration | ||||||
|  | @ -23,6 +23,19 @@ | ||||||
|     <spring-boot.version>2.7.8</spring-boot.version> |     <spring-boot.version>2.7.8</spring-boot.version> | ||||||
|   </properties> |   </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> |   <dependencies> | ||||||
|     <dependency> |     <dependency> | ||||||
|       <groupId>commons-cli</groupId> |       <groupId>commons-cli</groupId> | ||||||
|  | @ -102,13 +115,11 @@ | ||||||
|     <dependency> |     <dependency> | ||||||
|       <groupId>org.springframework.boot</groupId> |       <groupId>org.springframework.boot</groupId> | ||||||
|       <artifactId>spring-boot-starter-web</artifactId> |       <artifactId>spring-boot-starter-web</artifactId> | ||||||
|       <version>${spring-boot.version}</version> |  | ||||||
|       <scope>test</scope> |       <scope>test</scope> | ||||||
|     </dependency> |     </dependency> | ||||||
|     <dependency> |     <dependency> | ||||||
|       <groupId>org.springframework.boot</groupId> |       <groupId>org.springframework.boot</groupId> | ||||||
|       <artifactId>spring-boot-autoconfigure</artifactId> |       <artifactId>spring-boot-autoconfigure</artifactId> | ||||||
|       <version>${spring-boot.version}</version> |  | ||||||
|       <scope>test</scope> |       <scope>test</scope> | ||||||
|     </dependency> |     </dependency> | ||||||
|     <dependency> |     <dependency> | ||||||
|  | @ -203,4 +214,27 @@ | ||||||
|       </plugin> |       </plugin> | ||||||
|     </plugins> |     </plugins> | ||||||
|   </build> |   </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> | </project> | ||||||
|  |  | ||||||
|  | @ -28,7 +28,7 @@ import static io.dapr.it.Retry.callWithRetry; | ||||||
| public class AppRun implements Stoppable { | public class AppRun implements Stoppable { | ||||||
| 
 | 
 | ||||||
|   private static final String APP_COMMAND = |   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; |   private final DaprPorts ports; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -755,8 +755,8 @@ public class PubSubIT extends BaseIT { | ||||||
|         for (CloudEvent<ConvertToLong> message : messages) { |         for (CloudEvent<ConvertToLong> message : messages) { | ||||||
|           actual.add(message.getData()); |           actual.add(message.getData()); | ||||||
|         } |         } | ||||||
|  |         Assert.assertEquals(values, actual); | ||||||
|       }, 2000); |       }, 2000); | ||||||
|       Assert.assertEquals(values, actual); |  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ package io.dapr.it.tracing.http; | ||||||
| import io.opentelemetry.api.OpenTelemetry; | import io.opentelemetry.api.OpenTelemetry; | ||||||
| import io.opentelemetry.context.Context; | import io.opentelemetry.context.Context; | ||||||
| import io.opentelemetry.context.propagation.TextMapPropagator; | 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.beans.factory.annotation.Autowired; | ||||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||||
| import org.springframework.web.servlet.HandlerInterceptor; | import org.springframework.web.servlet.HandlerInterceptor; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue