# Configure build and start for Spring Boot

## Summary
Build and start for a Spring Boot app on Ample. Verified on Spring Boot: the app built and started with the documented commands and answered on its public HTTPS URL. 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
1. **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`.

2. **Deploy**  
   Run the synchronous deploy once and read the result.  
   **Command:** `ample deploy . --name --public`

3. **Verify**  
   Fetch the live URL on the example; on failure read the build and runtime logs.  
   **Command:** `ample logs --kind build`

## Tested Configuration
- **Template:** jvm-21  
- **Runtime:** java  
- **Size:** s-1vcpu-2gb  
- **Build Command:** `./mvnw -q -DskipTests package`  
- **Start Command:** `java -jar $(ls target/*.jar | grep -v -- '-plain' | head -n 1)`

## 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  
- **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.

## Examples
- **Title:** Spring Boot pattern fixture  
  **Description:** Verified build and start on Spring Boot.  
  **Source Ref:** tests/deploy-canaries/spring-boot-patterns

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

## 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: the app built and started with the documented commands and answered on its public HTTPS URL.  
  **Observed At:** 2026-09-21T02:34:39Z  
  **Implementation Revision:** 1d28ae0-dirty (CLI 0.1.21)  
  **Expires At:** 2027-03-20T02:34:39Z
