Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b86yyhhudsSLnwNUFY
1.7 KiB
1.7 KiB
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:*orgit 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 importcom.fasterxml.jackson.databind.*. - MockMvc tests:
@AutoConfigureMockMvclives inorg.springframework.boot.webmvc.test.autoconfigure. The oldorg.springframework.boot.test.autoconfigure.web.servletpackage does not exist in Boot 4. - Web starter is
spring-boot-starter-webmvc, test starter isspring-boot-starter-webmvc-test. - Constructor injection only. No field
@Autowiredinsrc/main.
Code conventions
- Money is
BigDecimalwith an explicitRoundingMode. Neverdouble. - DTOs are records. Entities are not returned from controllers.
- Errors: throw
IllegalArgumentExceptionfor bad input; the controller maps it to 400.
Database
- Flyway migrations live in
src/main/resources/db/migration. An applied migration is immutable: addV<next>__description.sql, never edit an existing file. A hook blocks edits to them. application-prod.propertiesis off limits. Ask the user.
Definition of done
mvn -B -q testis green.- New behaviour has a test in the matching
*Testclass. - Summarise what changed in three lines or fewer.
See @README.md for how to run the app and the sample requests.