BlogSpring Boot

How to deploy a Spring Boot app.

Spring Boot deploys with one sentence. Antideploy builds the jar and runs it, and you build the database URL from the PG variables.

How the Agent API works
  • Maven or GradleDetected from pom.xml or build.gradle
  • An executable jarThe build sets the entrypoint
  • Port 8080Read PORT to be safe
  • A JDBC URLBuilt from the PG variables

The short answer

To deploy a Spring Boot app, give your coding agent the sentence below. Antideploy finds pom.xml or build.gradle, builds your project into an executable jar, and runs it. The port is 8080, which is also Spring's default. For Postgres, Antideploy sets DATABASE_URL and the PG* variables, and Spring needs a JDBC URL, so you build one from the PG* variables. A Java app has 2 GB of memory.

Say this to your coding agent

Set this project up to deploy on Antideploy. Fetch https://antideploy.com/agent.md and follow it.

What Antideploy detects

  • Java. Detected from pom.xml for Maven, or build.gradle or build.gradle.kts for Gradle.
  • The start command. Antideploy does not add one. The build produces an executable jar and sets the entrypoint from it. Your project needs the Spring Boot plugin so the jar is executable.
  • The port. For Java projects, Antideploy sends traffic to port 8080 and sets PORT to match.
  • The database. Antideploy creates Postgres and sets DATABASE_URL and the PG* variables.

The settings your app needs

Spring does not read DATABASE_URL, because it is not a JDBC URL. Build the JDBC URL from the PG* variables that Antideploy sets.

application.properties
server.port=${PORT:8080}

spring.datasource.url=jdbc:postgresql://${PGHOST}:${PGPORT}/${PGDATABASE}?sslmode=require
spring.datasource.username=${PGUSER}
spring.datasource.password=${PGPASSWORD}

Add the PostgreSQL JDBC driver to your pom.xml or build.gradle. If you use Flyway or Liquibase, they run when the app starts. Antideploy's own migration step is for Prisma, Drizzle, Django and Alembic projects.

Memory and startup

A Spring Boot app is a Java process. Java apps run on 1 dedicated vCPU with 2 GB of memory in total, because a JVM starts slowly on a shared CPU. Other apps get 1 shared vCPU and 1 GB. Keep heap settings below 2 GB, and avoid loading large data at startup. A Spring Boot app also takes longer to start than a small Node or Python app, so the first request after the app sleeps can take longer too.

Step by step

  1. Check the build on your machine

    mvn package or ./gradlew build should produce a jar that runs with java -jar.

  2. Paste the sentence and approve one link

    Your agent creates the app and the database, and writes the connection details into your .env without printing them.

  3. Deploy and open the link

    Antideploy builds the project, starts the jar, and checks that it answers. If the app never listens on its port, the deploy fails and shows what the app printed before it exited.

Common problems

  • The app never starts listening. The jar crashed on startup, often a database setting. The deploy shows the last lines the app printed. See never started listening.
  • The build fails to compile. The deploy names the Java file and the error, or the Maven plugin that failed.
  • A connection refused. The datasource URL still points at localhost. Use the PG* variables.

01Before you commit

Here's where it stops.

A platform that only tells you what it is good at is one you find the edges of in production. These are the ones to know before your first deploy.

  1. Apps sleep when idle

    On every plan, an app nobody is using goes to sleep and the next visit wakes it. The first request took 2.9 to 13.9 seconds in our measurements, depending on the stack. There are no always-on workers, so use a cron job or a webhook for background work.

  2. One instance, no previews

    Each app is one instance with 1 shared vCPU and 1 GB of memory, and a Java app gets 1 dedicated vCPU and 2 GB. There are no preview deployments and no per-branch URLs.

  3. The disk forgets

    Anything written to local disk is gone on the next deploy. Apps that speak S3 get a bucket instead.

02Questions

Spring Boot questions, answered.

Anything else? Write to us and a person answers.

support@antideploy.com
Do I need a Dockerfile for Spring Boot?

No. If there is no Dockerfile, Antideploy builds the project with Maven or Gradle. If you add one at the root, it is used.

Which Java version is used?

The builder's. If your project needs a specific version, a Dockerfile gives you control.

Why is the first request slow?

Apps sleep when idle and the first request after sleeping waits for the app to start. Java apps start more slowly than small Node or Python apps.

What does it cost?

A Spring Boot app counts as one live app. The Free plan includes 1 live app with a server and 1 Postgres database.

Deploy something. Start with one sentence.

Paste one sentence into your coding agent, click Approve once, and get a live link. No card, no trial clock.

Start from GitHub or a folder
Prompt copied Paste it into Claude Code, Codex or Cursor and press Enter.