Read the root AGENTS.md first. Each module below also has its own AGENTS.md.
Eight self-contained Maven modules, each demonstrating one enterprise concern with
production-grade style but demo-grade scope. They are teaching material: heavy
Javadoc, modern Java 21 idioms, and deliberate patterns to copy. They are not
deployable services (the runnable app is ../app; restful-api is the one example
that also runs as a server).
| Module | Demonstrates | Runnable? | Unit tests | Needs Docker? |
|---|---|---|---|---|
restful-api/ |
Spring Boot REST server + 3 HTTP client styles, OpenAPI, global error handling | spring-boot:run on :8080 |
45 (controller, service, mapper, DTO, clients, context) | only for its Dockerfile |
database/ |
JPA/Hibernate entities, Spring Data, transactions, raw JDBC, Flyway, HikariCP | Spring Boot app (H2 in-memory) | 39 (entities, service, @DataJpaTest, @JdbcTest) |
no (H2) |
hpc/ |
Parallel streams, CompletableFuture, concurrent collections, virtual threads | no (static utility methods) | 36 | no |
etl/ |
Spark RDD/DataFrame/SQL, Spring Batch chunk job, pure-Java pipeline | no main class | 18 (pipeline + batch beans; Spark untested) | no |
systems/ |
JNI with fallback, off-heap memory, JMH benchmarks, MXBean profiling | PerformanceBenchmarks#main |
14 | no |
patterns/ |
15 GoF patterns in modern Java (records, sealed, switch matching) | no | 59 (one @Nested class per pattern) |
no |
simulation/ |
Monte Carlo (Welford's variance), discrete-event simulation (M/M/1) | both classes have main |
15 (statistical tolerance + deterministic engine) | no |
testing/ |
The reference for how to test: JUnit 5, Mockito, Testcontainers, REST Assured, ArchUnit | tests are the content | 18 unit + 8 IT methods in 2 classes | yes, for *IT |
- Parent
com.example.template:java-enterprise-templatevia<relativePath>../../pom.xml</relativePath>; artifactIdtemplate-<name>. <jacoco.skip>true</jacoco.skip>— no coverage gate here (unlikeapp/).- Checkstyle/PMD/SpotBugs still apply in full (under the scan profiles), including to
test sources. Example-code rule friction is handled with narrow, commented
@SuppressWarnings("PMD.X") // Example code: reasonannotations — follow that style. - Common test deps (JUnit 5, AssertJ, Mockito, SLF4J) are inherited; only
module-specific deps are declared, version-less (managed by the root pom).
Jersey, springdoc, and JMH versions live in root
dependencyManagement. - Empty
src/{main,test}/{java,resources}dirs are kept with.gitkeep— leave them. - Every module has a
README.md(human walkthrough) and anAGENTS.md(agent rules).
- One focused class (or one class per sub-topic) with a class Javadoc that lists what
it Demonstrates in a
<ul>, plus<pre>{@code ...}usage snippets. - Non-instantiable demo holders are
finalwith a private constructor and static methods. Spring-configured classes follow normal bean conventions. - Modern idioms first: records, sealed interfaces + exhaustive switch, text blocks,
var, functional interfaces withdefaultcomposition methods. - SLF4J for real logging;
System.outis allowed only insystems/andsimulation/(suppressed inconfig/checkstyle/checkstyle-suppressions.xml).
examples/<name>/withpom.xml(parent as above,template-<name>,<jacoco.skip>true</jacoco.skip>),src/main/java/com/example/template/<name>/,src/test/java/....- Register
<module>examples/<name></module>in the rootpom.xml. - Add
README.md(follow an existing one),AGENTS.md(follow a sibling), and a row in this file's module index plus the rootREADME.mdtables. - Verify:
./mvnw compile -pl examples/<name>then./mvnw verify -Psecurity-scan-quick -DskipTests -pl examples/<name>.
Full recipe: docs/EXTENDING.md.
Every module now ships a real unit-test suite (counts in the table above; 246 unit
@Test methods repo-wide including app, plus 8 IT methods). Keep it that way: new behavior lands with tests in the same
change, in the styles demonstrated by examples/testing/ and each module's existing
suite. Known intentional gap: Spark code in etl/ is untested (JVM-heavy); the
surefire --add-opens argLine is already in place if you add a local[*] test.
jacoco.skip=true remains set per module — don't remove it without enough coverage to
clear the parent's 80% bundle gate.