DockHosting Docs
Deploying

Spring Boot

Deploy a Spring Boot app on DockHosting — build, port binding, and databases.

DockHosting detects a Spring Boot project from a Maven pom.xml or Gradle build.gradle(.kts) at the repository root, builds it, and runs the resulting artifact.

Requirements

  • pom.xml (Maven) or build.gradle / build.gradle.kts (Gradle) at the repository root
  • A bootable jar produced by your build (spring-boot-maven-plugin or the Gradle Spring Boot plugin — both are the Spring Initializr defaults, so most projects already have this)
  • Your app listening on the port from the PORT environment variable

Reading PORT

Spring Boot reads server.port from configuration. Map the platform's PORT variable to it in application.properties:

server.port=${PORT:8080}

or application.yml:

server:
  port: ${PORT:8080}

Without this, Spring Boot defaults to 8080 regardless of what DockHosting actually expects, which can cause a readiness timeout if the two don't happen to match.

Databases

Spring Data JPA and plain JDBC both read spring.datasource.url — set it from the connection string DockHosting injects for an attached database. For Postgres and MySQL, the standard spring.datasource.url=${DATABASE_URL} pattern (with the JDBC prefix adjusted) works with Spring's environment-variable placeholder resolution.

Build time

A cold Maven or Gradle build (pulling every dependency fresh) is slower than most other stacks' first build. Subsequent deploys benefit from DockHosting's layer caching the same way any other build does — the difference is mostly noticeable on the very first deploy.

On this page