CLAUDE.md for Spring Boot

Component scanning boundaries and @Transactional proxy semantics are the two Spring facts every coding agent needs written down. Below is a complete, committable example for a typical Spring Boot project. To get one tailored to your dependencies and scripts, paste your manifest into the free generator (client-side, nothing uploaded) or run npx getagentready in your repo.

Complete example

# CLAUDE.md

This file guides Claude Code when working in this repository.

## Project

**example-service** — Stack: Java, Spring Boot.

## Commands

- Run dev server: `mvn spring-boot:run`
- Build: `mvn -q package`
- Run all tests: `mvn -q test`
- Format: `mvn spotless:apply`

## Testing

Add a test runner and record its commands here — agents work dramatically better when they can verify changes.

## Conventions

- Constructor injection over field injection; components discovered via classpath scanning under the main application package.
- Configuration in `application.yml` with `@ConfigurationProperties` classes, not scattered `@Value` reads.
- Layer boundaries: controllers thin, `@Service` for logic, `@Repository`/Spring Data for persistence; DTOs at the API edge, entities stay internal.
- Prefer small, focused changes; do not refactor unrelated code in the same change.
- Match the existing code style of the file you are editing over any global preference.
- Never commit secrets. `.env*` files are local-only.
- After making changes, run the test and lint commands above before considering work done.

## Gotchas

- Beans outside the main application package are silently not scanned — the most common "why is my bean null" cause.
- `@Transactional` on private or self-invoked methods does nothing (proxy-based AOP); calls must cross a bean boundary.
- Slice tests (`@WebMvcTest`, `@DataJpaTest`) load partial contexts — mock what the slice excludes or the context fails to start.

<!-- generated with https://getagentready.dev -->

Going further

This is the generated baseline. The Agent-Ready Pro Pack includes a hand-tuned, deeper Spring Boot configuration — architecture guidance, testing strategy, common-task recipes — plus 12 workflow skills and enforcement hooks. See also the CLAUDE.md guide and AGENTS.md guide.

Generate yours in 30 seconds — tailored to your actual Spring Boot repo. Generate mine →