From f2b546de5e98323c4058801c458d80e036dedbfb Mon Sep 17 00:00:00 2001 From: mariofusco Date: Thu, 23 Nov 2023 18:20:18 +0100 Subject: [PATCH] downgrade spring-boot version in order to make it java 11 compatible --- kogito-build/kogito-dependencies-bom/pom.xml | 2 +- .../decision/SpringBootEventDrivenDecisionController.java | 3 ++- .../events/mongodb/SpringbootMongoDBEventPublisher.java | 3 ++- .../SpringBootEventDrivenPredictionsController.java | 3 ++- .../jobs/management/springboot/SpringRestJobsService.java | 3 +-- .../spring/SpringBootKogitoExtensionInitializer.java | 3 ++- .../cloudevents/spring/SpringKafkaCloudEventEmitter.java | 1 + .../cloudevents/spring/SpringKafkaCloudEventReceiver.java | 3 ++- .../core/springboot/SpringbootMetricsInterceptor.java | 4 ++-- .../core/springboot/SpringMetricsInterceptorTest.java | 4 ++-- 10 files changed, 17 insertions(+), 12 deletions(-) diff --git a/kogito-build/kogito-dependencies-bom/pom.xml b/kogito-build/kogito-dependencies-bom/pom.xml index 8be455532b4..8bcece06a40 100644 --- a/kogito-build/kogito-dependencies-bom/pom.xml +++ b/kogito-build/kogito-dependencies-bom/pom.xml @@ -18,7 +18,7 @@ 3.5.2 ${version.io.quarkus} - 3.0.5 + 2.6.6 3.5.1 diff --git a/springboot/addons/events/decisions/src/main/java/org/kie/kogito/eventdriven/decision/SpringBootEventDrivenDecisionController.java b/springboot/addons/events/decisions/src/main/java/org/kie/kogito/eventdriven/decision/SpringBootEventDrivenDecisionController.java index 9b38468d832..b48f221fe95 100644 --- a/springboot/addons/events/decisions/src/main/java/org/kie/kogito/eventdriven/decision/SpringBootEventDrivenDecisionController.java +++ b/springboot/addons/events/decisions/src/main/java/org/kie/kogito/eventdriven/decision/SpringBootEventDrivenDecisionController.java @@ -18,7 +18,6 @@ */ package org.kie.kogito.eventdriven.decision; -import jakarta.annotation.PostConstruct; import org.kie.kogito.config.ConfigBean; import org.kie.kogito.decision.DecisionModels; import org.kie.kogito.event.EventEmitter; @@ -26,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import jakarta.annotation.PostConstruct; + @Component public class SpringBootEventDrivenDecisionController extends EventDrivenDecisionController { diff --git a/springboot/addons/events/mongodb/src/main/java/org/kie/kogito/events/mongodb/SpringbootMongoDBEventPublisher.java b/springboot/addons/events/mongodb/src/main/java/org/kie/kogito/events/mongodb/SpringbootMongoDBEventPublisher.java index e08186b6510..5fb16d922f2 100644 --- a/springboot/addons/events/mongodb/src/main/java/org/kie/kogito/events/mongodb/SpringbootMongoDBEventPublisher.java +++ b/springboot/addons/events/mongodb/src/main/java/org/kie/kogito/events/mongodb/SpringbootMongoDBEventPublisher.java @@ -18,7 +18,6 @@ */ package org.kie.kogito.events.mongodb; -import jakarta.annotation.PostConstruct; import org.kie.kogito.mongodb.transaction.AbstractTransactionManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -26,6 +25,8 @@ import com.mongodb.client.MongoClient; +import jakarta.annotation.PostConstruct; + @Component public class SpringbootMongoDBEventPublisher extends MongoDBEventPublisher { diff --git a/springboot/addons/events/predictions/src/main/java/org/kie/kogito/eventdriven/predictions/SpringBootEventDrivenPredictionsController.java b/springboot/addons/events/predictions/src/main/java/org/kie/kogito/eventdriven/predictions/SpringBootEventDrivenPredictionsController.java index 14a6d41dfca..c6fc5a3a662 100644 --- a/springboot/addons/events/predictions/src/main/java/org/kie/kogito/eventdriven/predictions/SpringBootEventDrivenPredictionsController.java +++ b/springboot/addons/events/predictions/src/main/java/org/kie/kogito/eventdriven/predictions/SpringBootEventDrivenPredictionsController.java @@ -18,7 +18,6 @@ */ package org.kie.kogito.eventdriven.predictions; -import jakarta.annotation.PostConstruct; import org.kie.kogito.config.ConfigBean; import org.kie.kogito.event.EventEmitter; import org.kie.kogito.event.EventReceiver; @@ -26,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import jakarta.annotation.PostConstruct; + @Component public class SpringBootEventDrivenPredictionsController extends EventDrivenPredictionsController { diff --git a/springboot/addons/jobs/src/main/java/org/kie/kogito/jobs/management/springboot/SpringRestJobsService.java b/springboot/addons/jobs/src/main/java/org/kie/kogito/jobs/management/springboot/SpringRestJobsService.java index 59eddb3c70e..a4902cead81 100644 --- a/springboot/addons/jobs/src/main/java/org/kie/kogito/jobs/management/springboot/SpringRestJobsService.java +++ b/springboot/addons/jobs/src/main/java/org/kie/kogito/jobs/management/springboot/SpringRestJobsService.java @@ -29,7 +29,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatusCode; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; @@ -86,7 +85,7 @@ public String scheduleProcessInstanceJob(ProcessInstanceJobDescription descripti ResponseEntity result = restTemplate.postForEntity(getJobsServiceUri(), request, String.class); - if (result.getStatusCode().isSameCodeAs(HttpStatusCode.valueOf(200))) { + if (result.getStatusCode().ordinal() == 200) { LOGGER.debug("Creating of the job {} done with status code {} ", job, result.getStatusCode()); } return job.getId(); diff --git a/springboot/addons/messaging/implementation/src/main/java/org/kie/kogito/addon/cloudevents/spring/SpringBootKogitoExtensionInitializer.java b/springboot/addons/messaging/implementation/src/main/java/org/kie/kogito/addon/cloudevents/spring/SpringBootKogitoExtensionInitializer.java index 4264e3fd482..ddcefb65ea0 100644 --- a/springboot/addons/messaging/implementation/src/main/java/org/kie/kogito/addon/cloudevents/spring/SpringBootKogitoExtensionInitializer.java +++ b/springboot/addons/messaging/implementation/src/main/java/org/kie/kogito/addon/cloudevents/spring/SpringBootKogitoExtensionInitializer.java @@ -18,7 +18,6 @@ */ package org.kie.kogito.addon.cloudevents.spring; -import jakarta.annotation.PostConstruct; import org.kie.kogito.event.cloudevents.extension.KogitoExtension; import org.kie.kogito.event.cloudevents.extension.KogitoPredictionsExtension; import org.kie.kogito.event.cloudevents.extension.KogitoProcessExtension; @@ -32,6 +31,8 @@ import io.cloudevents.jackson.JsonFormat; +import jakarta.annotation.PostConstruct; + /** * The goal of this bean is to register the Kogito CloudEvent extension * that allows the system to correctly parse Kogito extension attributes. diff --git a/springboot/addons/messaging/implementation/src/main/java/org/kie/kogito/addon/cloudevents/spring/SpringKafkaCloudEventEmitter.java b/springboot/addons/messaging/implementation/src/main/java/org/kie/kogito/addon/cloudevents/spring/SpringKafkaCloudEventEmitter.java index ad1edac7c69..279b589211b 100644 --- a/springboot/addons/messaging/implementation/src/main/java/org/kie/kogito/addon/cloudevents/spring/SpringKafkaCloudEventEmitter.java +++ b/springboot/addons/messaging/implementation/src/main/java/org/kie/kogito/addon/cloudevents/spring/SpringKafkaCloudEventEmitter.java @@ -64,6 +64,7 @@ public CompletionStage emit(DataEvent event) { env.getProperty("kogito.addon.cloudevents.kafka." + KogitoEventStreams.OUTGOING + "." + event.getType(), defaultTopicName), configBean.useCloudEvents() ? ceMarshaller.marshall(event.asCloudEvent(ceMarshaller.cloudEventDataFactory())) : marshaller.marshall(event.getData())) + .completable() .thenApply(r -> null); } catch (IOException e) { throw new UncheckedIOException(e); diff --git a/springboot/addons/messaging/implementation/src/main/java/org/kie/kogito/addon/cloudevents/spring/SpringKafkaCloudEventReceiver.java b/springboot/addons/messaging/implementation/src/main/java/org/kie/kogito/addon/cloudevents/spring/SpringKafkaCloudEventReceiver.java index 5330d48cc8b..a009f26c5a8 100644 --- a/springboot/addons/messaging/implementation/src/main/java/org/kie/kogito/addon/cloudevents/spring/SpringKafkaCloudEventReceiver.java +++ b/springboot/addons/messaging/implementation/src/main/java/org/kie/kogito/addon/cloudevents/spring/SpringKafkaCloudEventReceiver.java @@ -26,7 +26,6 @@ import java.util.concurrent.ExecutionException; import java.util.function.Function; -import jakarta.annotation.PostConstruct; import org.kie.kogito.config.ConfigBean; import org.kie.kogito.event.CloudEventUnmarshallerFactory; import org.kie.kogito.event.DataEvent; @@ -43,6 +42,8 @@ import org.springframework.messaging.handler.annotation.Payload; import org.springframework.stereotype.Component; +import jakarta.annotation.PostConstruct; + @Component public class SpringKafkaCloudEventReceiver implements EventReceiver { diff --git a/springboot/addons/monitoring/core/src/main/java/org/kie/kogito/monitoring/core/springboot/SpringbootMetricsInterceptor.java b/springboot/addons/monitoring/core/src/main/java/org/kie/kogito/monitoring/core/springboot/SpringbootMetricsInterceptor.java index 14b64f3ab4d..8428936c053 100644 --- a/springboot/addons/monitoring/core/src/main/java/org/kie/kogito/monitoring/core/springboot/SpringbootMetricsInterceptor.java +++ b/springboot/addons/monitoring/core/src/main/java/org/kie/kogito/monitoring/core/springboot/SpringbootMetricsInterceptor.java @@ -18,8 +18,8 @@ */ package org.kie.kogito.monitoring.core.springboot; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.kie.kogito.monitoring.core.common.system.interceptor.MetricsInterceptor; import org.springframework.lang.Nullable; diff --git a/springboot/addons/monitoring/core/src/test/java/org/kie/kogito/monitoring/core/springboot/SpringMetricsInterceptorTest.java b/springboot/addons/monitoring/core/src/test/java/org/kie/kogito/monitoring/core/springboot/SpringMetricsInterceptorTest.java index f1f7063f330..761ce48615d 100644 --- a/springboot/addons/monitoring/core/src/test/java/org/kie/kogito/monitoring/core/springboot/SpringMetricsInterceptorTest.java +++ b/springboot/addons/monitoring/core/src/test/java/org/kie/kogito/monitoring/core/springboot/SpringMetricsInterceptorTest.java @@ -20,8 +20,8 @@ import java.util.List; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.junit.jupiter.api.Test; import org.kie.kogito.monitoring.core.common.system.interceptor.MetricsInterceptor;