removed @Inject

This commit is contained in:
Francesco Mangiacrapa 2024-10-17 15:49:16 +02:00
parent 2dc1e7c8aa
commit aace2f9c3f
3 changed files with 3 additions and 24 deletions

View File

@ -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");

View File

@ -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) {

View File

@ -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();
}
}