Add a module
Each direct subpackage of {{BASE_PACKAGE}} is a module. ./mvnw verify fails if another module reaches into its nested packages or if modules form a cycle.
- Pick a name: a noun for the capability, such as
billing, notbillingserviceorcommon. Check that no existing module owns it; theModulessection ofAGENTS.mdlists them. - Create the layout:
Keep the top-level package small. Entities and repositories never go in it.{{BASE_PACKAGE}}.<module> public API: the service other modules call, the records it takes and returns, its events {{BASE_PACKAGE}}.<module>.internal everything else: implementation, entities, repositories, controllers - Let other modules talk to it in one of two ways only: call a type in its top-level package, or listen for an event it publishes (
@ApplicationModuleListener). Prefer events when the caller doesn't need an answer. - Add
src/test/java/{{BASE_PATH}}/<module>/<Module>ModuleTests.java, annotated@ApplicationModuleTest, which starts only this module. Test the module through its public API. - Add one line for the module to the
Modulessection ofAGENTS.md. - Run
./mvnw verify.


