Marketplace
spring-boot-modulith
Spring Modulith 2.0 implementation for bounded contexts in Spring Boot 4. Use when structuring application modules, implementing @ApplicationModuleListener for event-driven communication, testing with Scenario API, enforcing module boundaries, or externalizing events to Kafka/AMQP. For modular monolith architecture decisions, see the domain-driven-design skill.
$ Installieren
git clone https://github.com/joaquimscosta/arkhe-claude-plugins /tmp/arkhe-claude-plugins && cp -r /tmp/arkhe-claude-plugins/spring-boot/skills/spring-boot-modulith ~/.claude/skills/arkhe-claude-plugins// tip: Run this command in your terminal to install the skill
SKILL.md
name: spring-boot-modulith description: Spring Modulith 2.0 implementation for bounded contexts in Spring Boot 4. Use when structuring application modules, implementing @ApplicationModuleListener for event-driven communication, testing with Scenario API, enforcing module boundaries, or externalizing events to Kafka/AMQP. For modular monolith architecture decisions, see the domain-driven-design skill.
Spring Modulith for Bounded Contexts
Implements DDD bounded contexts as application modules with enforced boundaries and event-driven communication.
Core Concepts
| Concept | Description |
|---|---|
| Application Module | Package-based boundary = bounded context |
| Module API | Types in base package (public) |
| Internal | Types in sub-packages (encapsulated) |
| Events | Cross-module communication mechanism |
Module Structure
src/main/java/
âââ com.example/
â âââ Application.java â @SpringBootApplication
âââ com.example.order/ â Module: order
â âââ OrderService.java â Public API
â âââ OrderCreated.java â Public event
â âââ package-info.java â @ApplicationModule config
â âââ internal/ â Encapsulated
â âââ OrderRepository.java
â âââ OrderEntity.java
âââ com.example.inventory/ â Module: inventory
â âââ InventoryService.java
â âââ internal/
âââ com.example.shipping/ â Module: shipping
Types in com.example.order = public API
Types in com.example.order.internal = hidden from other modules
Quick Patterns
See EXAMPLES.md for complete working examples including:
- Module Configuration with @ApplicationModule
- Event Publishing with domain event records
- Event Handling with @ApplicationModuleListener (Java + Kotlin)
- Module Verification Test with PlantUML generation
- Event Externalization for Kafka/AMQP
Spring Boot 4 / Modulith 2.0 Specifics
- @ApplicationModuleListener combines
@Async+@Transactional(REQUIRES_NEW)+@TransactionalEventListener(AFTER_COMMIT) - Event Externalization with
@Externalizedannotation for Kafka/AMQP - JDBC event log ensures at-least-once delivery
Detailed References
- Examples: See EXAMPLES.md for complete working code examples
- Troubleshooting: See TROUBLESHOOTING.md for common issues and Boot 4 migration
- Module Structure: See references/module-structure.md for package conventions, named interfaces, dependency rules
- Event Patterns: See references/events.md for publishing, handling, externalization, testing with Scenario API
Anti-Pattern Checklist
| Anti-Pattern | Fix |
|---|---|
| Direct bean injection across modules | Use events or expose API |
| Synchronous cross-module calls | Use @ApplicationModuleListener |
| Module dependencies not declared | Add allowedDependencies in @ApplicationModule |
| Missing verification test | Add ApplicationModules.verify() test |
| Internal types in public API | Move to .internal sub-package |
| Events without data | Include all data handlers need |
Critical Reminders
- One module = one bounded context â Mirror DDD boundaries
- Events are the integration mechanism â Not direct method calls
- Verify in CI â
ApplicationModules.verify()catches boundary violations - Reference by ID â Never direct object references across modules
- Transaction per module â
@ApplicationModuleListenerensures isolation
Repository

joaquimscosta
Author
joaquimscosta/arkhe-claude-plugins/spring-boot/skills/spring-boot-modulith
1
Stars
0
Forks
Updated2d ago
Added1w ago