You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2019/12/11 16:49:10 UTC
[isis-app-simpleapp] 02/03: converts HealthCheckService into a
@Service, pass exception on error
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis-app-simpleapp.git
commit e2faf242346bff983777c85fb58ea2ae54215c00
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Dec 9 08:29:58 2019 +0000
converts HealthCheckService into a @Service, pass exception on error
---
.../services/health/HealthCheckServiceImpl.java | 23 ++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/webapp/src/main/java/domainapp/webapp/application/services/health/HealthCheckServiceImpl.java b/webapp/src/main/java/domainapp/webapp/application/services/health/HealthCheckServiceImpl.java
index 4a42b21..feaede6 100644
--- a/webapp/src/main/java/domainapp/webapp/application/services/health/HealthCheckServiceImpl.java
+++ b/webapp/src/main/java/domainapp/webapp/application/services/health/HealthCheckServiceImpl.java
@@ -1,29 +1,36 @@
package domainapp.webapp.application.services.health;
import javax.inject.Inject;
+import javax.inject.Named;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.services.health.Health;
import org.apache.isis.applib.services.health.HealthCheckService;
+import org.springframework.stereotype.Service;
import domainapp.modules.simple.dom.impl.SimpleObjects;
+import domainapp.modules.simple.dom.types.Name;
+import lombok.extern.log4j.Log4j2;
-@DomainService(nature = NatureOfService.DOMAIN)
+@Service
+@Named("domainapp.HealthCheckServiceImpl")
+@Log4j2
public class HealthCheckServiceImpl implements HealthCheckService {
+ private final SimpleObjects simpleObjects;
+
+ @Inject
+ public HealthCheckServiceImpl(SimpleObjects simpleObjects) {
+ this.simpleObjects = simpleObjects;
+ }
+
@Override
public Health check() {
-
try {
simpleObjects.ping();
return Health.ok();
} catch (Exception ex) {
- return Health.error(ex.getMessage());
+ return Health.error(ex);
}
}
-
- @Inject
- SimpleObjects simpleObjects;
}