# Deploy Spring Boot

Spring Boot is detected from your `pom.xml` or `build.gradle` and runs as a Java container on port `8080`. No Dockerfile needed - one is [generated](/platform/deployments/builds#dockerfiles-generated-or-your-own) unless the repo has its own.

## Serve it

Match the routed [port](/create/build-settings#port), either by leaving both at `8080`, or by mapping the `PORT` variable in `application.properties`:

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

Tomcat binds all interfaces by default - nothing else to configure.

## Configuration and database

Spring's relaxed binding maps [environment variables](/platform/environment-variables#build-time-and-runtime) onto properties - `SPRING_DATASOURCE_URL` becomes `spring.datasource.url`. From the database's [Credentials tab](/platform/databases/connect):

```
SPRING_DATASOURCE_URL=jdbc:postgresql://203.0.113.10:5432/mydb?sslmode=require
SPRING_DATASOURCE_USERNAME=appuser
SPRING_DATASOURCE_PASSWORD=...
```

Flyway and Liquibase run their migrations at startup by default, where the database is reachable - which fits the platform's model.

## Scaling

JVM startup is the slow end of [cold starts](/create/scaling#cold-starts) - seconds, not milliseconds. For production, set [min instances](/create/scaling#min-instances) to `1`; previews can stay at zero. Memory matters too: pick at least the [Small size](/create/application-settings#size) for a typical Boot app.

## Related

- [Java](/platform/frameworks/java): The runtime's defaults for any JVM app.
- [Connect an app](/platform/databases/connect): Connection details in JDBC shape.
- [Scaling](/create/scaling): Warm minimums for JVM apps.
