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.xmlfor Maven, orbuild.gradleorbuild.gradle.ktsfor 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
PORTto match. -
The database. Antideploy creates Postgres and sets
DATABASE_URLand thePG*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.
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
-
Check the build on your machine
mvn packageor./gradlew buildshould produce a jar that runs withjava -jar. -
Paste the sentence and approve one link
Your agent creates the app and the database, and writes the connection details into your
.envwithout printing them. -
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 thePG*variables.