diff --git a/jhipster-dependencies/pom.xml b/jhipster-dependencies/pom.xml
index 3c70e6967..f4f2a721e 100644
--- a/jhipster-dependencies/pom.xml
+++ b/jhipster-dependencies/pom.xml
@@ -67,9 +67,7 @@
1.13.1
8.0.30
21.7.0.0
- 0.27.0
- ${problem-spring.version}
- ${problem-spring.version}
+ 0.15.0
3.17.7
0.10.1
2022.0.0-M5
@@ -256,16 +254,6 @@
ojdbc8
${oracle-jdbc.version}
-
- org.zalando
- problem-spring-web
- ${problem-spring-web.version}
-
-
- org.zalando
- problem-spring-webflux
- ${problem-spring-webflux.version}
-
mysql
mysql-connector-java
diff --git a/jhipster-framework/src/main/java/tech/jhipster/web/rest/errors/ExceptionTranslation.java b/jhipster-framework/src/main/java/tech/jhipster/web/rest/errors/ExceptionTranslation.java
index 3338e5fb4..92bc238d7 100644
--- a/jhipster-framework/src/main/java/tech/jhipster/web/rest/errors/ExceptionTranslation.java
+++ b/jhipster-framework/src/main/java/tech/jhipster/web/rest/errors/ExceptionTranslation.java
@@ -38,5 +38,5 @@ public interface ExceptionTranslation {
* @param request The request that is being served
* @return Returns the Responseentity containing the ProblemDetail
*/
- public Mono> handleAnyException(Throwable ex, ServerWebExchange request);
+ public Mono> handleAnyException(Throwable ex, ServerWebExchange request);
}
diff --git a/jhipster-framework/src/main/java/tech/jhipster/web/rest/errors/ProblemDetailWithCause.java b/jhipster-framework/src/main/java/tech/jhipster/web/rest/errors/ProblemDetailWithCause.java
new file mode 100644
index 000000000..30d9f23e3
--- /dev/null
+++ b/jhipster-framework/src/main/java/tech/jhipster/web/rest/errors/ProblemDetailWithCause.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2016-2022 the original author or authors from the JHipster project.
+ *
+ * This file is part of the JHipster project, see https://www.jhipster.tech/
+ * for more information.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tech.jhipster.web.rest.errors;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import org.springframework.http.ProblemDetail;
+
+/*
+ * Class that extends Spring's ProblemDetail and has a Builder implementation.
+ */
+public class ProblemDetailWithCause extends ProblemDetail {
+ private ProblemDetailWithCause cause;
+
+ ProblemDetailWithCause(int rawStatus) {
+ super(rawStatus);
+ }
+
+ ProblemDetailWithCause(int rawStatus, ProblemDetailWithCause cause) {
+ super(rawStatus);
+ this.cause = cause;
+ }
+
+ public ProblemDetailWithCause getCause() {
+ return cause;
+ }
+
+ public void setCause(ProblemDetailWithCause cause) {
+ this.cause = cause;
+ }
+
+ // The missing builder from Spring
+ public static class ProblemDetailWithCauseBuilder {
+ private static final URI BLANK_TYPE = URI.create("about:blank");
+ // From Springs Problem Detail
+ private URI type = BLANK_TYPE;
+ private String title;
+ private int status;
+ private String detail;
+ private URI instance;
+ private Map properties = new HashMap<>();
+ private ProblemDetailWithCause cause;
+
+ public static ProblemDetailWithCauseBuilder instance(){
+ return new ProblemDetailWithCauseBuilder();
+ }
+
+ public ProblemDetailWithCauseBuilder withType(URI type) {
+ this.type = type;
+ return this;
+ }
+
+ public ProblemDetailWithCauseBuilder withTitle(String title) {
+ this.title = title;
+ return this;
+ }
+
+ public ProblemDetailWithCauseBuilder withStatus(int status) {
+ this.status = status;
+ return this;
+ }
+
+ public ProblemDetailWithCauseBuilder withDetail(String detail) {
+ this.detail = detail;
+ return this;
+ }
+
+ public ProblemDetailWithCauseBuilder withInstance(URI instance) {
+ this.instance = instance;
+ return this;
+ }
+
+ public ProblemDetailWithCauseBuilder withCause(ProblemDetailWithCause cause) {
+ this.cause = cause;
+ return this;
+ }
+
+ public ProblemDetailWithCauseBuilder withProperties(Map properties) {
+ this.properties = properties;
+ return this;
+ }
+
+ public ProblemDetailWithCauseBuilder withProperty(String key, Object value) {
+ this.properties.put(key, value);
+ return this;
+ }
+
+ public ProblemDetailWithCause build() {
+ ProblemDetailWithCause cause = new ProblemDetailWithCause(this.status);
+ cause.setType(this.type);
+ cause.setTitle(this.title);
+ cause.setDetail(this.detail);
+ cause.setInstance(this.instance);
+ this.properties.forEach(cause::setProperty);
+ cause.setCause(this.cause);
+ return cause;
+ }
+ }
+}
diff --git a/jhipster-framework/src/main/java/tech/jhipster/web/rest/errors/ReactiveWebExceptionHandler.java b/jhipster-framework/src/main/java/tech/jhipster/web/rest/errors/ReactiveWebExceptionHandler.java
index 8dff3d7fe..fdbcbb1be 100644
--- a/jhipster-framework/src/main/java/tech/jhipster/web/rest/errors/ReactiveWebExceptionHandler.java
+++ b/jhipster-framework/src/main/java/tech/jhipster/web/rest/errors/ReactiveWebExceptionHandler.java
@@ -57,13 +57,13 @@ public ReactiveWebExceptionHandler(ExceptionTranslation translator, ObjectMapper
@Override
public Mono handle(final ServerWebExchange exchange, final Throwable throwable) {
if (throwable instanceof ResponseStatusException) {
- final Mono> entityMono = translator.handleAnyException(throwable, exchange);
+ final Mono> entityMono = translator.handleAnyException(throwable, exchange);
return entityMono.flatMap(entity -> this.setHttpResponse(entity, exchange, mapper));
}
return Mono.error(throwable);
}
- private Mono setHttpResponse(final ResponseEntity entity, final ServerWebExchange exchange,
+ private Mono setHttpResponse(final ResponseEntity