Files

34 lines
1.7 KiB
Markdown

# Orders service (Spring Boot 4.2, Java 25, Maven)
REST service for orders. Package root: `com.ankurm.claudecode.orders`.
## Commands
- Run all tests: `mvn -B -q test`
- Run one test class: `mvn -B -q test -Dtest=OrderServiceTest -Dsurefire.failIfNoSpecifiedTests=false`
- Start the app: `mvn -B spring-boot:run`
- Never run `mvn deploy`, `mvn release:*` or `git push --force`. A hook blocks them.
## Spring Boot 4 rules (older habits and examples still use the Boot 3 names, so these matter)
- Jackson 3: import `tools.jackson.databind.*`. Do not import `com.fasterxml.jackson.databind.*`.
- MockMvc tests: `@AutoConfigureMockMvc` lives in `org.springframework.boot.webmvc.test.autoconfigure`.
The old `org.springframework.boot.test.autoconfigure.web.servlet` package does not exist in Boot 4.
- Web starter is `spring-boot-starter-webmvc`, test starter is `spring-boot-starter-webmvc-test`.
- Constructor injection only. No field `@Autowired` in `src/main`.
## Code conventions
- Money is `BigDecimal` with an explicit `RoundingMode`. Never `double`.
- DTOs are records. Entities are not returned from controllers.
- Errors: throw `IllegalArgumentException` for bad input; the controller maps it to 400.
## Database
- Flyway migrations live in `src/main/resources/db/migration`. An applied migration is immutable:
add `V<next>__description.sql`, never edit an existing file. A hook blocks edits to them.
- `application-prod.properties` is off limits. Ask the user.
## Definition of done
1. `mvn -B -q test` is green.
2. New behaviour has a test in the matching `*Test` class.
3. Summarise what changed in three lines or fewer.
See @README.md for how to run the app and the sample requests.