From f0c2f73735cceff0d5b50f252497b83aa14ad121 Mon Sep 17 00:00:00 2001 From: Sadeq Dousti <3616518+msdousti@users.noreply.github.com> Date: Tue, 20 Jun 2023 01:53:31 +0200 Subject: [PATCH] Apply changes to Auto-configuration See: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.7-Release-Notes#auto-configuration-registration --- .../autoconfigure/OpenTracingFlowIdAutoConfiguration.java | 3 ++- .../riptide/autoconfigure/RiptideAutoConfiguration.java | 4 ++-- .../riptide/autoconfigure/RiptideTestAutoConfiguration.java | 3 ++- .../src/main/resources/META-INF/spring.factories | 1 - ...ringframework.boot.autoconfigure.AutoConfiguration.imports | 3 +++ 5 files changed, 9 insertions(+), 5 deletions(-) delete mode 100644 riptide-spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories create mode 100644 riptide-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports diff --git a/riptide-spring-boot-autoconfigure/src/main/java/org/zalando/riptide/autoconfigure/OpenTracingFlowIdAutoConfiguration.java b/riptide-spring-boot-autoconfigure/src/main/java/org/zalando/riptide/autoconfigure/OpenTracingFlowIdAutoConfiguration.java index e19c8c216..e1a1a1e85 100644 --- a/riptide-spring-boot-autoconfigure/src/main/java/org/zalando/riptide/autoconfigure/OpenTracingFlowIdAutoConfiguration.java +++ b/riptide-spring-boot-autoconfigure/src/main/java/org/zalando/riptide/autoconfigure/OpenTracingFlowIdAutoConfiguration.java @@ -3,6 +3,7 @@ import io.opentracing.Tracer; import org.apache.hc.client5.http.classic.HttpClient; import org.apiguardian.api.API; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -22,7 +23,7 @@ * We use org.zalando.riptide.autoconfigure.FlowHttpRequestInterceptor, that is adapted to Apache HttpClient 5.x. */ @API(status = STABLE) -@Configuration +@AutoConfiguration @ConditionalOnBean(Tracer.class) @AutoConfigureAfter(name = { "org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration", diff --git a/riptide-spring-boot-autoconfigure/src/main/java/org/zalando/riptide/autoconfigure/RiptideAutoConfiguration.java b/riptide-spring-boot-autoconfigure/src/main/java/org/zalando/riptide/autoconfigure/RiptideAutoConfiguration.java index 51b5ead53..a36fd3188 100644 --- a/riptide-spring-boot-autoconfigure/src/main/java/org/zalando/riptide/autoconfigure/RiptideAutoConfiguration.java +++ b/riptide-spring-boot-autoconfigure/src/main/java/org/zalando/riptide/autoconfigure/RiptideAutoConfiguration.java @@ -1,16 +1,16 @@ package org.zalando.riptide.autoconfigure; import org.apiguardian.api.API; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; import static org.apiguardian.api.API.Status.INTERNAL; import static org.apiguardian.api.API.Status.STABLE; @API(status = STABLE) -@Configuration +@AutoConfiguration @AutoConfigureAfter(name = { "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration", "org.zalando.logbook.autoconfigure.LogbookAutoConfiguration", diff --git a/riptide-spring-boot-autoconfigure/src/main/java/org/zalando/riptide/autoconfigure/RiptideTestAutoConfiguration.java b/riptide-spring-boot-autoconfigure/src/main/java/org/zalando/riptide/autoconfigure/RiptideTestAutoConfiguration.java index 9fd8ce7be..db418bf52 100644 --- a/riptide-spring-boot-autoconfigure/src/main/java/org/zalando/riptide/autoconfigure/RiptideTestAutoConfiguration.java +++ b/riptide-spring-boot-autoconfigure/src/main/java/org/zalando/riptide/autoconfigure/RiptideTestAutoConfiguration.java @@ -2,6 +2,7 @@ import org.apiguardian.api.API; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -12,7 +13,7 @@ import static org.springframework.test.web.client.MockRestServiceServer.createServer; @API(status = EXPERIMENTAL) -@Configuration +@AutoConfiguration @AutoConfigureBefore(RiptideAutoConfiguration.class) public class RiptideTestAutoConfiguration { diff --git a/riptide-spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories b/riptide-spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 68f746204..000000000 --- a/riptide-spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration = org.zalando.riptide.autoconfigure.RiptideAutoConfiguration diff --git a/riptide-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/riptide-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..191dca3eb --- /dev/null +++ b/riptide-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,3 @@ +org.zalando.riptide.autoconfigure.OpenTracingFlowIdAutoConfiguration +org.zalando.riptide.autoconfigure.RiptideAutoConfiguration +org.zalando.riptide.autoconfigure.RiptideTestAutoConfiguration