Back to Prompts

Java Spring Boot

CLAUDE.md for Java Spring Boot applications with enterprise patterns

javaspring-bootbackendenterpriseapi
By Claude Code Community

CLAUDE.md Content

# Java Spring Boot Project

This is a Spring Boot application using Java.

## Project Structure
- `src/main/java/` - Application source code
- `src/main/resources/` - Configuration files
- `src/test/java/` - Test source code
- `pom.xml` or `build.gradle` - Build configuration

## Architecture
- `controller/` - REST endpoints
- `service/` - Business logic
- `repository/` - Data access layer
- `model/` or `entity/` - Domain objects
- `dto/` - Data transfer objects
- `config/` - Configuration classes

## Conventions
- Use constructor injection over field injection
- Follow layered architecture (Controller → Service → Repository)
- Use DTOs for API request/response, not entities
- Handle exceptions with @ControllerAdvice
- Use Bean Validation annotations for input validation

## Testing
- Unit test services with Mockito
- Integration test with @SpringBootTest
- Use @WebMvcTest for controller tests
- Use Testcontainers for database tests

## Commands
- `./mvnw spring-boot:run` - Start application
- `./mvnw test` - Run tests
- `./mvnw package` - Build JAR
- `./gradlew bootRun` - Start (Gradle)
- `./gradlew test` - Run tests (Gradle)

How to use

  1. Copy the content above
  2. Create a CLAUDE.md file in your project root
  3. Paste the content and customize as needed
  4. Claude Code will automatically use this context