From 8f7cf15f03230ceb457e7d5d446eb9b292dbbbfd Mon Sep 17 00:00:00 2001 From: lorne <1991wangliang@gmail.com> Date: Wed, 17 Sep 2025 14:11:13 +0800 Subject: [PATCH] update #152 #153 --- .../example-app-cmd-domain/pom.xml | 2 +- .../example-app/example-app-cmd-meta/pom.xml | 2 +- example/example-app/example-app-query/pom.xml | 2 +- example/example-app/pom.xml | 2 +- .../example-domain-leave/pom.xml | 2 +- .../example-domain-user/pom.xml | 2 +- example/example-domain/pom.xml | 2 +- .../example-infra/example-infra-flow/pom.xml | 2 +- .../example-infra/example-infra-jpa/pom.xml | 2 +- .../example-infra-security/pom.xml | 2 +- example/example-infra/pom.xml | 2 +- example/example-interface/pom.xml | 2 +- example/example-server/pom.xml | 2 +- example/pom.xml | 2 +- pom.xml | 2 +- springboot-starter-data-authorization/pom.xml | 2 +- springboot-starter-data-fast/pom.xml | 2 +- springboot-starter-flow/pom.xml | 2 +- .../flow/service/impl/FlowStartService.java | 2 +- springboot-starter-security/pom.xml | 2 +- springboot-starter/pom.xml | 2 +- .../framework/exception/EventException.java | 23 ++++++++++++++++--- .../exception/EventExceptionTest.java | 23 +++++++++++++++++++ 23 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 springboot-starter/src/test/java/com/codingapi/springboot/framework/exception/EventExceptionTest.java diff --git a/example/example-app/example-app-cmd-domain/pom.xml b/example/example-app/example-app-cmd-domain/pom.xml index aaccaa2f..b99ae784 100644 --- a/example/example-app/example-app-cmd-domain/pom.xml +++ b/example/example-app/example-app-cmd-domain/pom.xml @@ -6,7 +6,7 @@ com.codingapi.springboot example-app - 3.4.16 + 3.4.17 ../pom.xml diff --git a/example/example-app/example-app-cmd-meta/pom.xml b/example/example-app/example-app-cmd-meta/pom.xml index 80be2c01..19586a14 100644 --- a/example/example-app/example-app-cmd-meta/pom.xml +++ b/example/example-app/example-app-cmd-meta/pom.xml @@ -6,7 +6,7 @@ com.codingapi.springboot example-app - 3.4.16 + 3.4.17 ../pom.xml diff --git a/example/example-app/example-app-query/pom.xml b/example/example-app/example-app-query/pom.xml index eaa44893..3393d41f 100644 --- a/example/example-app/example-app-query/pom.xml +++ b/example/example-app/example-app-query/pom.xml @@ -6,7 +6,7 @@ com.codingapi.springboot example-app - 3.4.16 + 3.4.17 ../pom.xml diff --git a/example/example-app/pom.xml b/example/example-app/pom.xml index 854d89cd..58616021 100644 --- a/example/example-app/pom.xml +++ b/example/example-app/pom.xml @@ -6,7 +6,7 @@ com.codingapi.springboot springboot-example - 3.4.16 + 3.4.17 ../pom.xml pom diff --git a/example/example-domain/example-domain-leave/pom.xml b/example/example-domain/example-domain-leave/pom.xml index 265bb537..f73d17e8 100644 --- a/example/example-domain/example-domain-leave/pom.xml +++ b/example/example-domain/example-domain-leave/pom.xml @@ -6,7 +6,7 @@ com.codingapi.springboot example-domain - 3.4.16 + 3.4.17 ../pom.xml diff --git a/example/example-domain/example-domain-user/pom.xml b/example/example-domain/example-domain-user/pom.xml index d675518c..80da054c 100644 --- a/example/example-domain/example-domain-user/pom.xml +++ b/example/example-domain/example-domain-user/pom.xml @@ -6,7 +6,7 @@ com.codingapi.springboot example-domain - 3.4.16 + 3.4.17 ../pom.xml diff --git a/example/example-domain/pom.xml b/example/example-domain/pom.xml index 0f2a3277..a7abe7d0 100644 --- a/example/example-domain/pom.xml +++ b/example/example-domain/pom.xml @@ -5,7 +5,7 @@ com.codingapi.springboot springboot-example - 3.4.16 + 3.4.17 ../pom.xml 4.0.0 diff --git a/example/example-infra/example-infra-flow/pom.xml b/example/example-infra/example-infra-flow/pom.xml index 2c3b3d4f..5cbbc3ec 100644 --- a/example/example-infra/example-infra-flow/pom.xml +++ b/example/example-infra/example-infra-flow/pom.xml @@ -5,7 +5,7 @@ com.codingapi.springboot example-infra - 3.4.16 + 3.4.17 ../pom.xml diff --git a/example/example-infra/example-infra-jpa/pom.xml b/example/example-infra/example-infra-jpa/pom.xml index f8dc7c7d..0ca0c6b0 100644 --- a/example/example-infra/example-infra-jpa/pom.xml +++ b/example/example-infra/example-infra-jpa/pom.xml @@ -5,7 +5,7 @@ com.codingapi.springboot example-infra - 3.4.16 + 3.4.17 ../pom.xml diff --git a/example/example-infra/example-infra-security/pom.xml b/example/example-infra/example-infra-security/pom.xml index c9689d1a..09bf935a 100644 --- a/example/example-infra/example-infra-security/pom.xml +++ b/example/example-infra/example-infra-security/pom.xml @@ -6,7 +6,7 @@ com.codingapi.springboot example-infra - 3.4.16 + 3.4.17 ../pom.xml diff --git a/example/example-infra/pom.xml b/example/example-infra/pom.xml index fe016cbf..1da565b6 100644 --- a/example/example-infra/pom.xml +++ b/example/example-infra/pom.xml @@ -6,7 +6,7 @@ com.codingapi.springboot springboot-example - 3.4.16 + 3.4.17 ../pom.xml pom diff --git a/example/example-interface/pom.xml b/example/example-interface/pom.xml index fc3bb6ed..a0d9ec16 100644 --- a/example/example-interface/pom.xml +++ b/example/example-interface/pom.xml @@ -6,7 +6,7 @@ com.codingapi.springboot springboot-example - 3.4.16 + 3.4.17 example-interface diff --git a/example/example-server/pom.xml b/example/example-server/pom.xml index 2dab7b74..3ce32288 100644 --- a/example/example-server/pom.xml +++ b/example/example-server/pom.xml @@ -5,7 +5,7 @@ springboot-example com.codingapi.springboot - 3.4.16 + 3.4.17 4.0.0 diff --git a/example/pom.xml b/example/pom.xml index 2eaf2896..a4e87260 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -19,7 +19,7 @@ springboot-example - 3.4.16 + 3.4.17 springboot-example springboot-example project for Spring Boot diff --git a/pom.xml b/pom.xml index a6f1f1a7..0d4b0a66 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ com.codingapi.springboot springboot-parent - 3.4.16 + 3.4.17 https://github.com/codingapi/springboot-framewrok springboot-parent diff --git a/springboot-starter-data-authorization/pom.xml b/springboot-starter-data-authorization/pom.xml index 86777d89..d7f7484e 100644 --- a/springboot-starter-data-authorization/pom.xml +++ b/springboot-starter-data-authorization/pom.xml @@ -6,7 +6,7 @@ com.codingapi.springboot springboot-parent - 3.4.16 + 3.4.17 springboot-starter-data-authorization diff --git a/springboot-starter-data-fast/pom.xml b/springboot-starter-data-fast/pom.xml index 64a82916..6bc86a45 100644 --- a/springboot-starter-data-fast/pom.xml +++ b/springboot-starter-data-fast/pom.xml @@ -5,7 +5,7 @@ springboot-parent com.codingapi.springboot - 3.4.16 + 3.4.17 4.0.0 diff --git a/springboot-starter-flow/pom.xml b/springboot-starter-flow/pom.xml index 7c7999a6..9b3197a4 100644 --- a/springboot-starter-flow/pom.xml +++ b/springboot-starter-flow/pom.xml @@ -6,7 +6,7 @@ springboot-parent com.codingapi.springboot - 3.4.16 + 3.4.17 springboot-starter-flow diff --git a/springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/service/impl/FlowStartService.java b/springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/service/impl/FlowStartService.java index d035a5e4..c8b8c127 100644 --- a/springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/service/impl/FlowStartService.java +++ b/springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/service/impl/FlowStartService.java @@ -66,7 +66,7 @@ private void loadFlowWork() { flowWork.enableValidate(); } - private void loadFlowBackup() { + private synchronized void loadFlowBackup() { FlowBackupRepository flowBackupRepository = flowServiceRepositoryHolder.getFlowBackupRepository(); this.flowBackup = flowBackupRepository.getFlowBackupByWorkIdAndVersion(flowWork.getId(), flowWork.getUpdateTime()); if (flowBackup == null) { diff --git a/springboot-starter-security/pom.xml b/springboot-starter-security/pom.xml index 3df6a656..2bf74218 100644 --- a/springboot-starter-security/pom.xml +++ b/springboot-starter-security/pom.xml @@ -6,7 +6,7 @@ springboot-parent com.codingapi.springboot - 3.4.16 + 3.4.17 springboot-starter-security diff --git a/springboot-starter/pom.xml b/springboot-starter/pom.xml index 741d9fdc..ad014114 100644 --- a/springboot-starter/pom.xml +++ b/springboot-starter/pom.xml @@ -5,7 +5,7 @@ com.codingapi.springboot springboot-parent - 3.4.16 + 3.4.17 springboot-starter diff --git a/springboot-starter/src/main/java/com/codingapi/springboot/framework/exception/EventException.java b/springboot-starter/src/main/java/com/codingapi/springboot/framework/exception/EventException.java index 5a506fec..dec33086 100644 --- a/springboot-starter/src/main/java/com/codingapi/springboot/framework/exception/EventException.java +++ b/springboot-starter/src/main/java/com/codingapi/springboot/framework/exception/EventException.java @@ -3,7 +3,6 @@ import lombok.Getter; import java.util.List; -import java.util.stream.Collectors; @Getter public class EventException extends RuntimeException { @@ -11,10 +10,28 @@ public class EventException extends RuntimeException { private final List error; public EventException(List error) { - super(error.stream().map(Exception::getMessage).collect(Collectors.joining("\n"))); + super(EventException.convert(error)); this.error = error; for (Exception e : error) { - e.printStackTrace(); + this.addSuppressed(e); } } + + private static String convert(List errors){ + if (errors == null || errors.isEmpty()) { + return "No errors."; + } + StringBuilder message = new StringBuilder(); + message.append("Has ").append(errors.size()).append(" Errors:\n"); + int index = 1; + for (Exception exception : errors) { + message.append(index++) + .append(". ") + .append(exception.getClass().getSimpleName()) + .append(": ") + .append(exception.getMessage()) + .append("\n"); + } + return message.toString(); + } } diff --git a/springboot-starter/src/test/java/com/codingapi/springboot/framework/exception/EventExceptionTest.java b/springboot-starter/src/test/java/com/codingapi/springboot/framework/exception/EventExceptionTest.java new file mode 100644 index 00000000..606edca5 --- /dev/null +++ b/springboot-starter/src/test/java/com/codingapi/springboot/framework/exception/EventExceptionTest.java @@ -0,0 +1,23 @@ +package com.codingapi.springboot.framework.exception; + +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; +import static org.junit.jupiter.api.Assertions.*; + +public class EventExceptionTest { + + @Test + void test(){ + List exceptions = new ArrayList<>(); + exceptions.add(new RuntimeException("123123")); + exceptions.add(new RuntimeException("234234")); + EventException eventException = new EventException(exceptions); + assertThrows(EventException.class,()->{ + throw eventException; + }); + + eventException.printStackTrace(); + } +}