# Explain the Architecture of a Spring Boot Codebase

An agent maps spring-petclinic from its build files to the SQL, runs it on H2, and traces an owner search from the form to the rendered list.

[Run this on Rush](https://cloud.getrush.ai/run/architecture-overview/spring-boot/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent starts at the build: `pom.xml` and `build.gradle` both use Spring Boot 4.1.0, and the Gradle toolchain asks for Java 17. It reads `PetClinicApplication`, the entities under `model/` and `owner/`, `OwnerController`, `OwnerRepository`, `db/h2/schema.sql` and `application.properties`, where `database=h2` picks the schema and data scripts and `spring.jpa.open-in-view=false` is set.

Then it runs `./mvnw spring-boot:run` with SQL logging on, searches owners for `davis` in the browser, and reads the Hibernate SQL the search logged. It reads `/actuator/mappings` and `/actuator/caches`, and labels each claim in `architecture.md` as static or observed.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Read the attached Spring Boot repository and write architecture.md. Record the commit, the build system and its Spring Boot and Java versions, the starters in use and the entry point. Explain each package's ownership, the JPA entities and their relationships, the repositories, the web layer and templates, caching, configuration profiles and database setup. Trace one representative request from the HTTP form through the controller and Spring Data repository to the SQL and back to the rendered view. Include Mermaid component and request-flow diagrams, with file:line citations and short source quotes for factual claims. Run the app with the documented local command if feasible using the in-memory database, exercise the traced request in the browser, and read the actuator mappings; distinguish observed behavior from static analysis and record any setup failure. Do not change app code, access production, push or open a pull request.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

Tried on spring-projects/spring-petclinic at 500158f: 1 file changed, 206 insertions(+), a new `architecture.md` in 12 sections with two Mermaid diagrams, an ER diagram and a traced `GET /owners?lastName=davis`, which the browser answered with Betty Davis and Harold Davis. `./mvnw -B -q test` exited 0 before and after, and the app logged `Started PetClinicApplication in 4.94 seconds (process running for 5.327)`. The sandbox had no Java, so the agent installed Temurin JDK 21.0.13; the project targets 17.

For the reviewer: the run infers that the `JCacheManagerCustomizer` in `CacheConfiguration` is never applied, since `/actuator/caches` shows the `vets` cache as native Caffeine, but it did not check `/actuator/conditions`. With no Docker, `MySqlIntegrationTests` and `PostgresIntegrationTests` did not run, so the MySQL and Postgres profiles are described from source only.

## Run it on every first of the month

An automation with a `schedule` trigger, `cron` set to `0 8 1 * *` in your `timezone`, runs this prompt against the Project's repository each month and returns a fresh `architecture.md` as the session's artifact. Diffed against last month's, it shows a new entity, a moved controller or a starter added to `pom.xml`.

## Why run it on Rush?

The running app showed `/actuator/caches` reporting the `vets` cache as native Caffeine beside a `JCacheManagerCustomizer` bean, which the document marks unconfirmed because `/actuator/conditions` was not checked. It labels each claim the same way: the owner search was run, logged and seen in a browser; the MySQL and Postgres profiles were only read.

## Frequently asked questions

### Why JDK 21 when the project asks for 17?

The sandbox had no Java, and the agent installed Temurin 21 to run `./mvnw`. Tests and the app passed on it, but a problem specific to 17 would not show; the notes ask for a rerun on a 17 JDK if that evidence matters.

### What did the run not exercise?

Write paths such as `POST /owners/new`, error pages, the `?lang=` switch and the H2 console the README mentions. The `/oups` exceptions in the test log are deliberate: PetClinic throws them on purpose to show its error page.

## More Spring Boot jobs

- [Dockerize a Spring Boot App](https://getrush.ai/run/dockerize-app/spring-boot/)
- [Fix a Spring Boot App Bug From a Datadog Monitor Alert](https://getrush.ai/run/fix-datadog-alerts/spring-boot/)
- [Fix a Failing CI Build in a Spring Boot Project](https://getrush.ai/run/fix-failing-ci/spring-boot/)

## The same job on other stacks

- [Explain the Architecture of an ASP.NET Core Solution](https://getrush.ai/run/architecture-overview/aspnet-core/)
- [Explain the Architecture of a Django Codebase](https://getrush.ai/run/architecture-overview/django/)
- [Explain the Architecture of an Elixir Codebase](https://getrush.ai/run/architecture-overview/elixir/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
