How spring-projects/spring-data-commons works
Project Type and Purpose
• This is an open-source Java/Kotlin library (Spring Data Commons) providing reusable repository interfaces, metadata models, and object-mapping abstractions for the Spring Data ecosystem.
• It’s not a service or application but a modular framework component that other Spring Data projects depend on.
File Structure Analysis
• Top‐level build & CI:
• pom.xml, mvnw, .github/workflows/*, Jenkinsfile, ci/pipeline.properties
• Documentation:
• src/main/antora – Antora playbook and docs modules (asciidoc pages).
• Core code:
• src/main/java/org/springframework/data – dozens of subpackages (annotation, aot, auditing, config, convert, core, crossstore, domain, expression, geo, mapping, projection, querydsl, repository, spel, support, transaction, util, web, etc.)
• src/main/kotlin – Kotlin extensions for mapping and repositories.
• Resources:
• src/main/resources/META-INF (spring.factories, handlers, schemas, tooling, aot.factories)
• Tests:
• src/test/{java,kotlin,resources} – unit and integration tests per module.
README Insights
• Describes the library’s shared-infrastructure role, features (repository abstractions, cross-store persistence, dynamic query generation, auditing, custom code integration, Spring namespace support).
• Recommends Maven wrapper build, JDK 17+, reference docs, snapshot repos.
• Points to Antora for doc generation.
Main Components
a. Core Modules (logical grouping):
• Repository Abstractions: org.springframework.data.repository
• Object Mapping & Conversion: org.springframework.data.mapping, org.springframework.data.convert
• Query Generation: org.springframework.data.repository.query, org.springframework.data.querydsl
• Auditing: org.springframework.data.auditing
• AOT Support: org.springframework.data.aot
• Domain & Utility: org.springframework.data.domain, org.springframework.data.util, org.springframework.data.core
• Cross-Store: org.springframework.data.crossstore
• Web Integration: org.springframework.data.web
• Extensions: org.springframework.data.projection, org.springframework.data.geo, org.springframework.data.history, javapoet
b. Build & Delivery:
• Maven Wrapper & pom.xml
• CI Pipelines: GitHub Actions, Jenkins
• Maven Central / Spring Repo (artifact publication)
c. Documentation:
• Antora Playbook → Asciidoc modules → Generated HTML
Relationships & Interactions
• Each module depends on Spring Core (& Spring Framework) at runtime.
• Higher-level modules (e.g., repository) depend on lower-level modules (convert, mapping, core).
• AOT processors hook into build → generate code fragments → packaged into jar.
• Antora reads src/main/antora → outputs site → included as part of release artifacts/website.
• CI steps: checkout → mvnw clean install (–Pantora) → run tests → publish JARs and docs.
Architectural Patterns & Design Principles
• Layered modular design: separation of concerns (mapping, repository, query, auditing).
• Extension points: callbacks, AOT processors, custom repository implementations.
• Convention over configuration: query methods generate SQL from method names.
• Pluggable modules via spring.factories and META-INF services.
Technologies & Frameworks
• Java 17+, Kotlin
• Maven + Maven Wrapper
• Spring Framework core
• Antora (documentation)
• GitHub Actions, Jenkins for CI
• JSON/XML schemas in resources for namespace support
• JUnit, KotlinTest for testing