# Configure environment and secrets for Spring Boot

Configuration and secrets for a Spring Boot app on Ample. Verified on Spring Boot: an --env value delivered encrypted and reported as present without being echoed (secret=set). Build and start: `./mvnw -q -DskipTests package` (or the Gradle wrapper) producing one application jar, then `java -jar` on the jvm-21 template (Temurin JDK 21) with `server.port` read from PORT.

## Prerequisites
- A Spring Boot project (`./mvnw -q -DskipTests package` (or the Gradle wrapper) producing one application jar, then `java -jar` on the jvm-21 template (Temurin JDK 21) with `server.port` read from PORT)
- An Ample account token with `servers:write`

## Workflow Steps
### Build and start
`./mvnw -q -DskipTests package` (or the Gradle wrapper) producing one application jar, then `java -jar` on the jvm-21 template (Temurin JDK 21) with `server.port` read from PORT; the server must bind 0.0.0.0 on PORT.

### Pass values on deploy
Use `--env KEY=value` (repeatable) or `--env-file`; values are encrypted at rest and reused on redeploys. Declare names only in `ample.toml`.

Command: `ample deploy . --name --public --env MY_SECRET=...`

### Verify
Fetch the live URL and `/p/configuration-secrets` on the example; on failure read the build and runtime logs.

Command: `ample logs --kind build`

## Examples
### Spring Boot pattern fixture
Verified configuration and secrets on Spring Boot.

Source Reference: `tests/deploy-canaries/spring-boot-patterns`

## Success Checks
- **App responds on its public URL**
  - Kind: `http_get`
  - Path: `/`
  - Expect: `ample canary spring boot patterns`

- **Configuration-secrets check from the example**
  - Kind: `http_get`
  - Path: `/p/configuration-secrets`
  - Expect: `see the pattern fixture checks`

## Limitations
- Verified on the jvm-21 template at `s-1vcpu-2gb`; other sizes and Spring Boot major versions are not verified.
- Region, compliance attestations, and request-duration limits are unknown and not claimed.

## Cost Estimate
- **Currency:** USD
- **Monthly Amount:** 5.0
- **Basis:** Size prices from `pricing.toml` (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty

### Components
- **Name:** App server
  - Size: `s-1vcpu-1gb`
  - Quantity: 1.0
  - Monthly Amount: 5.0

Note: Always-on monthly price of the tested sizes; apps auto-pause when idle. Buckets are allocation-priced per quota and not included.

## Evidence Summary
- **Kind:** canary_run
- **Summary:** Spring Boot pattern fixture deployed on Ample (`./mvnw -q -DskipTests package` (or the Gradle wrapper) producing one application jar, then `java -jar` on the jvm-21 template (Temurin JDK 21) with `server.port` read from PORT); for this guide: an --env value delivered encrypted and reported as present without being echoed (secret=set).
- **Observed At:** 2026-09-21T02:34:39Z
- **Implementation Revision:** 1d28ae0-dirty (CLI 0.1.21)
- **Expires At:** 2027-03-20T02:34:39Z
- **Scope:**
  - **Checks:** `/p/configuration-secrets`
  - **Template:** jvm-21

## Unknowns
- Region availability is unknown until a verified region fact is recorded
- Compliance attestations are unknown; none are claimed.

## Formats
- **HTML:** [View](/content/guides/spring-boot/configuration-secrets/index.html)
- **Markdown:** [View](/content/guides/spring-boot/configuration-secrets.md)
- **JSON:** [View](https://api.ample.computer/v1/catalog/recipes/page%3Aguides%3Aspring-boot%3Aconfiguration-secrets)
