EthioDeploy
DocsPricingDomainsBlogToolsChangelog
Deploy guides/Spring Boot

Deploy a Spring Boot app

Spring Boot apps are detected from pom.xml or gradlew, built into a jar with the JDK your build file asks for (17 or 21), and started with the port passed in. A project from Spring Initializr deploys with no settings, as long as it targets Java 17 or 21.

Last updated November 24, 2026

What we run by default
Detected by
pom.xml, or gradlew
Install
none
Build
./mvnw ... -DskipTests clean install, or ./gradlew clean build -x check -x test
Start
java -Dserver.port=$PORT $JAVA_OPTS -jar target/*jar (Maven)

These run automatically, so leave the command fields blank. Only override them in Settings → Build if you need something different.

Fix this first: Java 25 and 27 need a Dockerfile

We read the Java version from your pom.xml or build.gradle and build with JDK 17 or 21 to match. Those are the newest JDKs our default build has. A project made for Java 25 or 27 stops at compile time with release version 25 not supported, and the build log says why. Choose 21 in Initializr, or build from a Dockerfile.

Prepare your app

A project from Spring Initializr deploys without any env vars. The JDK comes from the Java version in your build file (java.version in pom.xml, the toolchain or sourceCompatibility in build.gradle):

  • Java 17: JDK 17, the default.
  • Java 21: JDK 21, picked for you. To choose yourself, set NIXPACKS_JDK_VERSION; your value wins.
  • Java 25 or 27: not available in our default build. Choose 21 in Initializr, or build from a Dockerfile (see below).

Maven

We run your ./mvnw (or mvn if there's no wrapper) with -DskipTests clean install, then start the jar in target/ with java -Dserver.port=$PORT $JAVA_OPTS -jar target/*jar. Commit the .mvn folder along with mvnw; the wrapper needs it.

Gradle

Gradle is detected from gradlew, so commit the wrapper (gradlew and the gradle/ folder). Initializr generates a Gradle 9 wrapper, and that works as is: the build runs ./gradlew clean build -x check -x test, and your wrapper downloads the Gradle version it names. The jar from build/libs (not the -plain one) is started with the port passed in, the same as with Maven.

Port

Spring Boot listens on 8080 unless server.port says otherwise, and it doesn't read a PORT variable on its own. Our default start command passes -Dserver.port=$PORT, so this is handled. If you set your own Start command in Settings → Build, keep that flag, or put this in application.properties:

server.port=${PORT:8080}

Spring Boot already listens on every interface. Don't set server.address.

Health check

Every deploy requests your health check path (/ by default) and only goes live once it returns a 2xx or 3xx status. The platform keeps checking it after that. If / returns 404 or needs a login, add a route like /healthz that returns 200 and set it as the Health Check Path in Settings. Otherwise the deploy fails and the previous version keeps serving. A new project has no mapping for /, so it answers 404 and the first deploy fails. Add the Actuator starter, which Initializr lists as “Spring Boot Actuator”:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

Then set the Health Check Path to /actuator/health. It returns 200 with {"status":"UP"}, and health is the only Actuator endpoint exposed over HTTP by default. With a database configured, it also checks the connection.

Add a database

Add a Postgres addon and DATABASE_URL is set for you, in the form postgres://user:password@host:5432/dbname. Spring's datasource wants a JDBC URL with the username and password as separate properties, so it can't use that string as it is. Convert it in a small config class (with spring-boot-starter-jdbc or Data JPA, and the org.postgresql:postgresql driver):

import java.net.URI;
import javax.sql.DataSource;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
class DatabaseConfig {
	@Bean
	DataSource dataSource() {
		URI db = URI.create(System.getenv("DATABASE_URL"));
		String[] user = db.getUserInfo().split(":", 2);
		return DataSourceBuilder.create()
				.url("jdbc:postgresql://" + db.getHost() + ":" + db.getPort() + db.getPath())
				.username(user[0])
				.password(user[1])
				.build();
	}
}

The database is only reachable from the running app, not during the build. The build skips tests, which keeps a @SpringBootTest that needs a database from failing it. Run Flyway or Liquibase migrations on startup, which is what Spring Boot does by default when either is on the classpath.

HTTPS and redirects

HTTPS ends at our proxy, and your app receives plain HTTP with X-Forwarded-Proto: https. Spring ignores that header by default, so redirects and generated links (Spring Security's login redirect, OAuth2 callback URLs) come out as http://. Tell Spring to use the forwarded headers:

server.request.header.forwarded.strategy=web-server

That's the Spring Boot 4.2 name. On older versions, the same setting is server.forward-headers-strategy=native.

Memory and startup time

The JVM needs more room than Node or Go. In our test, a Spring Boot 4.2 app with Web and Actuator, limited the way the Free plan limits it (256 MB, half a CPU), took 13 seconds to start and used about 185 MB. With JDBC and Postgres added, it took 23 seconds and 208 MB. The same app with 1 GB and one CPU, as on Pro, started in 4 seconds.

That startup time matters twice. A deploy fails if the app doesn't pass its health check within 30 seconds of starting, and a Free app waking from sleep holds the visitor's request for up to 30 seconds. A larger app with JPA and Spring Security can miss both on half a CPU. For anything past a small API, use Pro.

The start command includes $JAVA_OPTS, so you can tune the JVM with an env var, for example JAVA_OPTS=-XX:MaxRAMPercentage=75 to give the heap a larger share of the container's memory.

Java 25 and other setups: use a Dockerfile

For a JDK our default build doesn't offer, or a custom build, add a Dockerfile. With the Builder setting on Auto, we build it instead of detecting the stack. The app must still listen on PORT, which is 3000:

FROM eclipse-temurin:25-jdk AS build
WORKDIR /src
COPY . .
RUN ./mvnw -B -DskipTests package

FROM eclipse-temurin:25-jre
COPY --from=build /src/target/*.jar /app.jar
EXPOSE 3000
CMD ["sh", "-c", "java -Dserver.port=${PORT:-3000} $JAVA_OPTS -jar /app.jar"]

Keep a shell in the final image: the deploy runs a sh command inside the container to mark it ready, so distroless images without /bin/sh fail.

Can Spring Boot run on the Free plan?

The Free plan costs nothing and needs no card. It includes:

  • One project, live over HTTPS at <project-slug>.ethiodeploy.app.
  • 256 MB of memory and half a CPU core.
  • A managed Postgres, MySQL or Redis addon with 512 MB of storage. It doesn't expire.
  • A redeploy on every push, the same as the paid plans.

The catch is sleep. After 30 minutes without traffic the app stops, and the next request starts it again. We hold that request for up to 30 seconds while the app boots, so the first visitor after a quiet spell waits a little.

A small Spring Boot API fits, with little room to spare: our test app used about 185 MB of the 256 MB and took 13 seconds to start on half a CPU. Every wake from sleep pays that startup again.

When the app has to stay awake or needs your own domain, Pro is $10 or 1,399 ETB a month: always on, 1 GB of memory and a 5 GB database.

Deploy

  1. Sign in with GitHub and install the EthioDeploy app on the repo.
  2. Click “New Project” and pick the repo.
  3. Watch the build in the dashboard. When the health check passes, your app is live at <project-slug>.ethiodeploy.app. Every push to the default branch redeploys, and the old version keeps serving until the new one is healthy.

Troubleshooting

Error: Unsupported Gradle version: 9+

Cause: NIXPACKS_GRADLE_VERSION is set to 9 or higher in the project's env vars. Without it, we handle Gradle 9 wrappers for you.

Fix: Remove NIXPACKS_GRADLE_VERSION, or set it to 8. Your wrapper still builds with the version it names.

Build fails: error: release version 21 not supported+

Cause: The build used JDK 17 for a Java 21 project: the Java version is set somewhere we don't read, or NIXPACKS_JDK_VERSION is set to 17.

Fix: Set NIXPACKS_JDK_VERSION=21.

Error: Unsupported JDK version: 25+

Cause: NIXPACKS_JDK_VERSION asks for a JDK our default build doesn't have. 21 is the newest.

Fix: Target Java 21, or build from a Dockerfile with the JDK you need.

Deploy fails: GET / returned 404+

Cause: Nothing is mapped to /, so Spring answers with its 404 error page.

Fix: Add Actuator and set the Health Check Path to /actuator/health.

Health check timed out after 30000ms+

Cause: The app took longer than 30 seconds to start, usually on the Free plan's half CPU, or it listens on a fixed port.

Fix: Keep -Dserver.port=$PORT in the start command, check the log for the “Started ... in N seconds” line, and move to Pro if startup is the problem.

IllegalArgumentException: 'url' must start with "jdbc"+

Cause: DATABASE_URL was passed to spring.datasource.url as it is.

Fix: Convert it to a JDBC URL with a separate username and password, as in the DatabaseConfig class above.

Still stuck? Check the deployment's build log in the dashboard, or see Troubleshooting.

Questions

A small one, yes. The Free plan gives 256 MB of memory and half a CPU; a Spring Boot 4.2 app with Web and Actuator used about 185 MB and took 13 seconds to start in our test. It sleeps after 30 minutes without traffic and pays that startup again on the next request. Pro ($10/month) gives 1 GB and one CPU, and never sleeps.

No, for Java 17 or 21 with Maven or Gradle. We detect pom.xml or gradlew, build the jar and start it with the port passed in. Use a Dockerfile for Java 25 or a custom build.

Java 17 and 21. We read the version from pom.xml or build.gradle and pick the matching JDK; NIXPACKS_JDK_VERSION overrides it (older versions such as 11 work too). Java 25 and newer need a Dockerfile.

The addon sets DATABASE_URL as postgres://user:password@host:5432/dbname. Spring needs a JDBC URL and separate credentials, so build the DataSource from DATABASE_URL in a small @Configuration class.

Ready to deploy?

Sign in with GitHub and pick your repo. No Dockerfile, no YAML.

More guides

ASP.NET CoreTelegram botDiscord bot

All guides on the deploy guides page. Custom domains, env vars, addons and billing are in the docs.

On this page
Prepare your appPortHealth checkAdd a databaseHTTPS and redirectsMemory and startup timeJava 25 and other setups: use a DockerfileCan Spring Boot run on the Free plan?DeployTroubleshootingQuestions
Deploying with an agent?Point it at llms.txt. Every guide is in one file there.Open llms-full.txt →
EthioDeploy

Agentic first development and deployment, started in Ethiopia, built for developers everywhere.

Telegram community
Product
PricingAI coding agentAgent mode docsDomainsCLIFree backend hostingHosting in EthiopiaChangelog
Deploy guides
Next.jsNode.jsPythonSvelteKitTanStack StartAstroNuxtReact RouterHonoStrapiPayload CMSDjangoFastAPIFlaskStreamlitExpressNestJSLaravelRailsGoSpring BootASP.NET CoreTelegram botDiscord botWhatsApp botLovableBoltReplitv0Google AI StudioBase44Firebase StudioClaude Code & Cursor
Compare
vs Herokuvs Vercelvs Rendervs Railwayvs Fly.iovs Netlifyvs KoyebHeroku alternativesVercel alternativesNetlify alternativesRender alternativesRailway alternativesFly.io alternativesReplit alternativesPythonAnywhere alternativesDigitalOcean App Platform alternativesGlitch alternatives
Resources
DocsBlogFree toolsAboutSupportContactllms.txt
© 2026 EthioDeployPay by card in USD or bank transfer in ETBTermsPrivacy