diff --git a/generators/docker/templates/docker/app.yml.ejs b/generators/docker/templates/docker/app.yml.ejs
index c7d90b5c61cc..5e67130687a0 100644
--- a/generators/docker/templates/docker/app.yml.ejs
+++ b/generators/docker/templates/docker/app.yml.ejs
@@ -95,6 +95,8 @@ _%>
<%_ if (cacheProviderInfinispan) { _%>
- JAVA_OPTS=-Djgroups.tcp.address=NON_LOOPBACK -Djava.net.preferIPv4Stack=true
<%_ } _%>
+ - THC_PORT=<%= serverPort %>
+ - THC_PATH=/management/health
<%_ if (applicationTypeMonolith || applicationTypeGateway) { _%>
# If you want to expose these ports outside your dev PC,
# remove the "127.0.0.1:" prefix
@@ -102,7 +104,7 @@ _%>
- 127.0.0.1:<%= serverPort %>:<%= serverPort %>
<%_ } _%>
healthcheck:
- test: ['CMD', 'curl', '-f', 'http://localhost:<%= serverPort %>/management/health']
+ test: ['CMD', '/workspace/health-check']
interval: 5s
timeout: 5s
retries: 40
diff --git a/generators/spring-boot/templates/build.gradle.ejs b/generators/spring-boot/templates/build.gradle.ejs
index 68bd8d831a89..acbf5a7a1552 100644
--- a/generators/spring-boot/templates/build.gradle.ejs
+++ b/generators/spring-boot/templates/build.gradle.ejs
@@ -266,10 +266,14 @@ task cleanResources(type: Delete) {
bootBuildImage {
builder = "paketobuildpacks/builder-jammy-buildpackless-tiny"
- buildpacks = ["paketobuildpacks/java"]
+ buildpacks = [
+ "paketobuildpacks/java",
+ "paketobuildpacks/health-checker"
+ ]
tags = ["<%- lowercaseBaseName %>"]
environment = [
"BPL_SPRING_AOT_ENABLED" : "true",
+ "BP_HEALTH_CHECKER_ENABLED" : "true",
"BP_JVM_CDS_ENABLED" : "false",
"BP_JVM_VERSION": "<%= JAVA_VERSION %>"
]
diff --git a/generators/spring-boot/templates/pom.xml.ejs b/generators/spring-boot/templates/pom.xml.ejs
index 329a07e7a3ef..9f3683bffe4e 100644
--- a/generators/spring-boot/templates/pom.xml.ejs
+++ b/generators/spring-boot/templates/pom.xml.ejs
@@ -541,12 +541,14 @@
paketobuildpacks/builder-jammy-buildpackless-tiny
paketobuildpacks/java
+ paketobuildpacks/health-checker
<%- lowercaseBaseName %>
true
+ true
false
${java.version}