From aace2f9c3f72e495d6643265c6fc454d2bc48212 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Thu, 17 Oct 2024 15:49:16 +0200 Subject: [PATCH] removed @Inject --- .../service/health/GeoportalHealthCheck.java | 11 ----------- .../geoportal/service/health/MongoHealthCheck.java | 5 +---- .../geoportal/service/rest/GeoportalHealth.java | 11 ++--------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/health/GeoportalHealthCheck.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/health/GeoportalHealthCheck.java index 5d0ff7b..ae8f94f 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/health/GeoportalHealthCheck.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/health/GeoportalHealthCheck.java @@ -1,11 +1,6 @@ package org.gcube.application.geoportal.service.health; import javax.enterprise.context.ApplicationScoped; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.eclipse.microprofile.health.HealthCheck; import org.eclipse.microprofile.health.HealthCheckResponse; @@ -22,12 +17,6 @@ public class GeoportalHealthCheck implements HealthCheck { private static final String SERVICE_NAME = "geooportal-service"; -// @Override -// public HealthCheckResponse call() { -// log.info(GeoportalHealthCheck.class.getSimpleName() + " call"); -// return HealthCheckResponse.named(SERVICE_NAME).state(true).build(); -// } - @Override public HealthCheckResponse call() { log.info(GeoportalHealthCheck.class.getSimpleName() + " call"); diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/health/MongoHealthCheck.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/health/MongoHealthCheck.java index e73b086..ca7b1b4 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/health/MongoHealthCheck.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/health/MongoHealthCheck.java @@ -1,8 +1,6 @@ package org.gcube.application.geoportal.service.health; import javax.enterprise.context.ApplicationScoped; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Response; import org.eclipse.microprofile.health.HealthCheck; import org.eclipse.microprofile.health.HealthCheckResponse; @@ -32,9 +30,8 @@ public class MongoHealthCheck implements HealthCheck { return checkMongo(context); } - public MongoHealthCheck context(String context) { + public MongoHealthCheck(String context) { this.context = context; - return this; } private HealthCheckResponse checkMongo(String context) { diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/GeoportalHealth.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/GeoportalHealth.java index fed36bd..549b030 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/GeoportalHealth.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/GeoportalHealth.java @@ -1,6 +1,5 @@ package org.gcube.application.geoportal.service.rest; -import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; @@ -17,18 +16,12 @@ import lombok.extern.slf4j.Slf4j; @Slf4j public class GeoportalHealth { - @Inject - GeoportalHealthCheck geoportalHC; - - @Inject - MongoHealthCheck mongoHC; - @GET @Path("") @Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) public HealthCheckResponse serviceCheck() { log.info("serviceCheck called"); - return geoportalHC.call(); + return new GeoportalHealthCheck().call(); } @GET @@ -40,7 +33,7 @@ public class GeoportalHealth { return HealthCheckResponse.named("databaseCheck") .withData("context", "is required parameter (e.g. context=/gcube/devsec/devVRE)").down().build(); - return mongoHC.context(context).call(); + return new MongoHealthCheck(context).call(); } }