# Deploy Java

Any JVM web app runs as a container on the Java runtime - the machinery behind the [Spring Boot](/platform/frameworks/spring-boot) and [Quarkus](/platform/frameworks/quarkus) guides, available to Micronaut, Javalin, Vert.x, Ktor, and plain servlet apps too. Detection reads your Maven or Gradle build; the default port is `8080`.

## The contract

- Listen on the routed [port](/create/build-settings#port), or read the `PORT` variable, which is set to it.
- Bind `0.0.0.0` - a loopback bind is unreachable from outside the container.
- Log to stdout/stderr for [runtime logs](/platform/observability#runtime-logs).

## Configuration and database

Containers receive [environment variables](/platform/environment-variables#build-time-and-runtime) at runtime - read them with `System.getenv` or your framework's config layer. JDBC details come from the database's [Credentials tab](/platform/databases/connect):

```
jdbc:postgresql://203.0.113.10:5432/mydb?sslmode=require
```

## Scaling

JVM cold starts run seconds - keep production at [min instances](/create/scaling#min-instances) `1` and give the heap room with at least the [Small size](/create/application-settings#size). Previews stay happily at zero.

## Related

- [Spring Boot](/platform/frameworks/spring-boot): Relaxed binding and datasource variables.
- [Quarkus](/platform/frameworks/quarkus): Fast JVM startup, native option.
- [Dockerfile](/platform/frameworks/docker): Custom JDKs, jlink images, native builds.
