diff --git a/src/main/java/com/eactive/apim/portal/apps/ReadinessController.java b/src/main/java/com/eactive/apim/portal/apps/ReadinessController.java index 125bb9f..230d425 100644 --- a/src/main/java/com/eactive/apim/portal/apps/ReadinessController.java +++ b/src/main/java/com/eactive/apim/portal/apps/ReadinessController.java @@ -10,14 +10,21 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; +import org.thymeleaf.spring5.SpringTemplateEngine; /** * Readiness probe. * *
Distinct from {@link HealthCheckController} (liveness — servlet alive?). * This endpoint validates both EMS and Gateway datasources via JDBC - * {@code Connection.isValid(timeout)} to confirm the app is ready to serve - * requests that depend on the database. + * {@code Connection.isValid(timeout)}, and the Thymeleaf {@link SpringTemplateEngine} + * configuration, to confirm the app is ready to serve real page requests. + * + *
The template-engine check exists because this controller bypasses view + * resolution entirely (plain {@code @RestController} JSON) — a broken + * {@code TemplateEngine.getConfiguration()} (e.g. classpath split causing + * {@link java.util.ServiceConfigurationError} during dialect/module discovery) + * previously left every real page returning 500 while this probe still reported 200. * *
HTTP 200 + JSON when all checks pass. *
HTTP 503 + JSON when any check fails — body still includes the per-component
@@ -30,24 +37,29 @@ public class ReadinessController {
private final DataSource portalDataSource;
private final DataSource gatewayDataSource;
+ private final SpringTemplateEngine templateEngine;
public ReadinessController(
@Qualifier("portalDataSource") DataSource portalDataSource,
- @Qualifier("gatewayDataSource") DataSource gatewayDataSource) {
+ @Qualifier("gatewayDataSource") DataSource gatewayDataSource,
+ SpringTemplateEngine templateEngine) {
this.portalDataSource = portalDataSource;
this.gatewayDataSource = gatewayDataSource;
+ this.templateEngine = templateEngine;
}
@GetMapping(value = "/health/ready", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity