Develop#3
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new Unit of Work (UoW) module (plus Spring integration) and restructures/extends the DDD module, updating the multi-module Maven build and documentation to reflect the new modules.
Changes:
- Adds
uowmodule (UnitOfWork core types + tests + module README docs). - Adds Spring auto-configuration + AOP aspect to apply
@UnitOfWorkto Spring beans. - Renames/expands the DDD module and updates parent/root POMs + top-level READMEs accordingly.
Reviewed changes
Copilot reviewed 29 out of 44 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| uow/src/test/java/com/euonia/uow/UnitOfWorkTest.java | Adds unit tests for UnitOfWork lifecycle and context behavior. |
| uow/src/test/java/com/euonia/uow/UnitOfWorkOptionsTest.java | Adds unit tests for UnitOfWorkOptions normalization behavior. |
| uow/src/test/java/com/euonia/uow/UnitOfWorkManagerTest.java | Adds unit tests for ambient/current UoW behavior and nesting. |
| uow/src/main/java/com/euonia/uow/UnitOfWorkOptions.java | Introduces options object for UoW configuration. |
| uow/src/main/java/com/euonia/uow/UnitOfWorkManager.java | Adds manager to begin UoW scopes and manage ambient UoW via accessor. |
| uow/src/main/java/com/euonia/uow/UnitOfWorkIsolationLevel.java | Adds isolation-level enum intended to map to JDBC constants. |
| uow/src/main/java/com/euonia/uow/UnitOfWorkHelper.java | Adds helper utilities for detecting enabled/disabled @UnitOfWork usage. |
| uow/src/main/java/com/euonia/uow/UnitOfWorkFailure.java | Adds failure event type for failed/rolled-back UoW notifications. |
| uow/src/main/java/com/euonia/uow/UnitOfWorkEvent.java | Adds base event type for completed/disposed notifications. |
| uow/src/main/java/com/euonia/uow/UnitOfWorkEnabled.java | Adds marker interface to indicate a type should run under UoW. |
| uow/src/main/java/com/euonia/uow/UnitOfWorkContext.java | Adds abstraction for transactional resources participating in a UoW. |
| uow/src/main/java/com/euonia/uow/UnitOfWorkAccessor.java | Adds ThreadLocal-based ambient UoW accessor. |
| uow/src/main/java/com/euonia/uow/UnitOfWork.java | Adds main UoW implementation coordinating contexts, handlers, listeners. |
| uow/src/main/java/com/euonia/uow/ChildUnitOfWork.java | Adds wrapper for nested scopes when requiresNew is false. |
| uow/src/main/java/com/euonia/uow/annotation/UnitOfWork.java | Adds annotation for declarative unit-of-work boundaries. |
| uow/README.zh.md | Adds Chinese module documentation for UoW usage and integration. |
| uow/README.md | Adds English module documentation for UoW usage and integration. |
| uow/pom.xml | Adds Maven module definition for unit-of-work. |
| spring/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports | Registers UoW auto-configuration for Spring Boot autoconfig discovery. |
| spring/src/main/java/com/euonia/uow/UnitOfWorkAutoConfiguration.java | Adds Spring Boot auto-configuration for UoW beans + aspect. |
| spring/src/main/java/com/euonia/uow/UnitOfWorkAspect.java | Adds Spring AOP aspect to wrap @UnitOfWork methods. |
| spring/pom.xml | Updates Spring module dependencies (adds spring-aop + aspectj weaver + uow dep). |
| README.zh.md | Updates top-level Chinese README to include UoW module and rename Domain → DDD. |
| README.md | Updates top-level English README to include UoW module and rename Domain → DDD. |
| pom.xml | Updates parent reactor modules (adds uow, renames domain → ddd) + dependency properties. |
| pipeline/pom.xml | Switches JUnit dependency version to inherited property. |
| osba/pom.xml | Adds JUnit dependency for OSBA module tests. |
| ddd/src/main/java/com/euonia/domain/ValueObject.java | Adds reflection-based value object base implementation. |
| ddd/src/main/java/com/euonia/domain/event/EventBase.java | Adds base event implementation with properties + IDs. |
| ddd/src/main/java/com/euonia/domain/event/EventAggregate.java | Adds event metadata aggregate model. |
| ddd/src/main/java/com/euonia/domain/event/Event.java | Adds event interface contract. |
| ddd/src/main/java/com/euonia/domain/event/DomainEventBase.java | Adds domain event base implementation (attach + aggregate conversion). |
| ddd/src/main/java/com/euonia/domain/event/DomainEvent.java | Adds domain event interface contract. |
| ddd/src/main/java/com/euonia/domain/event/ApplicationEventBase.java | Adds application event base class. |
| ddd/src/main/java/com/euonia/domain/event/ApplicationEvent.java | Adds application event marker interface. |
| ddd/src/main/java/com/euonia/domain/EntityBase.java | Adds base entity implementation. |
| ddd/src/main/java/com/euonia/domain/Entity.java | Adds entity interface contract. |
| ddd/src/main/java/com/euonia/domain/auditing/AuditStore.java | Adds audit store interface for persisting audit records. |
| ddd/src/main/java/com/euonia/domain/auditing/AuditRecord.java | Adds audit record entity type. |
| ddd/src/main/java/com/euonia/domain/auditing/Audited.java | Adds audited marker annotation. |
| ddd/src/main/java/com/euonia/domain/AggregateBase.java | Adds base aggregate with domain-event collection support. |
| ddd/src/main/java/com/euonia/domain/Aggregate.java | Adds aggregate interface. |
| ddd/pom.xml | Renames artifactId to domain-driven-design + adds dependencies. |
| core/pom.xml | Switches JUnit version to inherited property and updates Surefire plugin version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+282
to
+304
| saveChangesAsync().whenComplete((ignored, throwable) -> { | ||
| try { | ||
| if (throwable != null) { | ||
| failure = unwrap(throwable); | ||
| result.completeExceptionally(failure); | ||
| return; | ||
| } | ||
|
|
||
| completed = true; | ||
| invokeCompletedHandlers().whenComplete((unused, handlerFailure) -> { | ||
| if (handlerFailure != null) { | ||
| failure = unwrap(handlerFailure); | ||
| result.completeExceptionally(failure); | ||
| return; | ||
| } | ||
|
|
||
| notifyCompleted(); | ||
| result.complete(null); | ||
| }); | ||
| } finally { | ||
| completing = false; | ||
| } | ||
| }); |
| throw new IllegalArgumentException("factory"); | ||
| } | ||
|
|
||
| return contexts.computeIfAbsent(key, ignored -> factory.get()); |
| } | ||
|
|
||
| if (this.options != null) { | ||
| throw new IllegalStateException("This unit of work is already initialized before!"); |
Comment on lines
+75
to
+83
| private static boolean anyMethodHasUnitOfWorkAnnotation(Class<?> implementationType) { | ||
| for (Method method : implementationType.getDeclaredMethods()) { | ||
| if (method.isAnnotationPresent(UnitOfWork.class)) { | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| return false; | ||
| } |
Comment on lines
+62
to
+70
| try (UnitOfWork uow = unitOfWorkManager.begin(new UnitOfWorkOptions(true), false)) { | ||
| Object result = pjp.proceed(); | ||
| uow.completeAsync().toCompletableFuture().join(); | ||
| return result; | ||
| } catch (Throwable t) { | ||
| // close() (via try-with-resources) detects !completed | ||
| // and fires failed listeners automatically | ||
| throw t; | ||
| } |
Comment on lines
+23
to
+26
| * <h3>Usage</h3> | ||
| * <p>For Spring Boot, this configuration is auto-detected via | ||
| * {@code spring.factories}. For plain Spring, import it manually:</p> | ||
| * <pre>{@code |
Comment on lines
+66
to
+73
| | Class / Interface | Purpose | | ||
| |-------------------|---------| | ||
| | `IUnitOfWork` | Unit-of-work contract with lifecycle methods (`saveChanges`, `commit`, `rollback`) | | ||
| | `IUnitOfWorkManager` | Creates/manages current unit-of-work scope | | ||
| | `UnitOfWork` | Default unit-of-work implementation | | ||
| | `UnitOfWorkBase` | Base class for shared transaction flow | | ||
| | `UnitOfWorkInterceptor` | Intercepts application flow to attach UoW boundaries | | ||
| | `IUnitOfWorkAccessor` | Access current active unit-of-work context | |
Comment on lines
+66
to
+74
| | 类 / 接口 | 作用 | | ||
| |-------------------|---------| | ||
| | `IUnitOfWork` | UoW 契约,包含生命周期方法(`saveChanges`、`commit`、`rollback`) | | ||
| | `IUnitOfWorkManager` | 创建并管理当前 UoW 作用域 | | ||
| | `UnitOfWork` | 默认 UoW 实现 | | ||
| | `UnitOfWorkBase` | 共享事务流程的基类 | | ||
| | `UnitOfWorkInterceptor` | 拦截应用流程并附加 UoW 边界 | | ||
| | `IUnitOfWorkAccessor` | 访问当前激活的 UoW 上下文 | | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.