Skip to content

Commit c38df5b

Browse files
committed
Use bean reference to create HealthCheck instances
Signed-off-by: Thiago Henrique Hüpner <[email protected]>
1 parent dcd9d88 commit c38df5b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

appserver/microprofile/health-glassfish/src/main/java/org/glassfish/microprofile/health/service/CollectHealthChecksExtension.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ public void afterDeploymentValidation(@Observes AfterDeploymentValidation adv, B
8888
healthChecks.forEach(healthCheckBeanAndKind -> {
8989
Bean<HealthCheck> bean = healthCheckBeanAndKind.bean();
9090
CreationalContext<HealthCheck> creationalContext = beanManager.createCreationalContext(bean);
91-
HealthCheck healthCheck = bean.create(creationalContext);
92-
93-
service.addHealthCheck(invocationManager.getCurrentInvocation().getAppName(),
94-
new HealthCheckInfo(healthCheck, healthCheckBeanAndKind.kind()));
91+
if (beanManager.getReference(bean, HealthCheck.class, creationalContext) instanceof HealthCheck healthCheck) {
92+
service.addHealthCheck(invocationManager.getCurrentInvocation().getAppName(),
93+
new HealthCheckInfo(healthCheck, healthCheckBeanAndKind.kind()));
94+
}
9595
});
9696
}
9797
}

0 commit comments

Comments
 (0)