diff --git a/pom.xml b/pom.xml
index 17ab605e7a..4344347d18 100644
--- a/pom.xml
+++ b/pom.xml
@@ -628,6 +628,7 @@
spring-boot-custom-starter
spring-boot-disable-console-logging
+ spring-boot-exceptions
spring-boot-jasypt
spring-boot-keycloak
spring-boot-logging-log4j2
@@ -825,7 +826,8 @@
spring-boot-client
spring-boot-configuration
spring-boot-custom-starter
- greeter-spring-boot-autoconfigure
+ spring-boot-exceptions
+ greeter-spring-boot-autoconfigure
greeter-spring-boot-sample-app
persistence-modules/spring-boot-h2/spring-boot-h2-database
spring-boot-jasypt
@@ -1286,6 +1288,7 @@
spring-boot-ctx-fluent
spring-boot-custom-starter
spring-boot-disable-console-logging
+ spring-boot-exceptions
spring-boot-jasypt
spring-boot-keycloak
diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/.gitignore b/spring-boot-exceptions/.gitignore
similarity index 100%
rename from spring-boot-exceptions/pass-exception-to-client-json-spring-boot/.gitignore
rename to spring-boot-exceptions/.gitignore
diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/pom.xml b/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/pom.xml
deleted file mode 100644
index 8237955aef..0000000000
--- a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/pom.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
- 4.0.0
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.1.4.RELEASE
-
-
- com.baeldung
- pass-exception-to-client-json-spring-boot
- 0.0.4-SNAPSHOT
- pass-exception-to-client-json-spring-boot
- Baeldung article code on how to pass exceptions to client in JSON format using Spring Boot
-
-
- 1.8
-
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/PassExceptionToClientJsonSpringBootApplication.java b/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/PassExceptionToClientJsonSpringBootApplication.java
deleted file mode 100644
index 77833c28fd..0000000000
--- a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/PassExceptionToClientJsonSpringBootApplication.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.baeldung.passexceptiontoclientjsonspringboot;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class PassExceptionToClientJsonSpringBootApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(PassExceptionToClientJsonSpringBootApplication.class, args);
- }
-
-}
\ No newline at end of file
diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/test/java/com/baeldung/passexceptiontoclientjsonspringboot/MainControllerIntegrationTest.java b/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/test/java/com/baeldung/passexceptiontoclientjsonspringboot/MainControllerIntegrationTest.java
deleted file mode 100644
index a615dc5096..0000000000
--- a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/test/java/com/baeldung/passexceptiontoclientjsonspringboot/MainControllerIntegrationTest.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.baeldung.passexceptiontoclientjsonspringboot;
-
-import org.junit.Test;
-
-public class MainControllerIntegrationTest {
-
- @Test(expected = CustomException.class)
- public void givenIndex_thenCustomException() throws CustomException {
-
- MainController mainController = new MainController();
-
- mainController.index();
-
- }
-
-}
\ No newline at end of file
diff --git a/spring-boot-exceptions/pom.xml b/spring-boot-exceptions/pom.xml
new file mode 100644
index 0000000000..105f60e295
--- /dev/null
+++ b/spring-boot-exceptions/pom.xml
@@ -0,0 +1,37 @@
+
+
+ 4.0.0
+
+
+ com.baeldung
+ parent-boot-2
+ 0.0.1-SNAPSHOT
+ ../parent-boot-2
+
+
+ com.baeldung
+ spring-boot-exceptions
+ 0.0.4-SNAPSHOT
+ pass-exception-to-client-json-spring-boot
+ Baeldung article code on how to pass exceptions to client in JSON format using Spring Boot
+
+
+ 1.8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/CustomException.java b/spring-boot-exceptions/src/main/java/com/baeldung/jsonexception/CustomException.java
similarity index 77%
rename from spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/CustomException.java
rename to spring-boot-exceptions/src/main/java/com/baeldung/jsonexception/CustomException.java
index 56fe80cd9a..f1a1d94f54 100644
--- a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/CustomException.java
+++ b/spring-boot-exceptions/src/main/java/com/baeldung/jsonexception/CustomException.java
@@ -1,4 +1,4 @@
-package com.baeldung.passexceptiontoclientjsonspringboot;
+package com.baeldung.jsonexception;
public class CustomException extends RuntimeException {
diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/ErrorHandler.java b/spring-boot-exceptions/src/main/java/com/baeldung/jsonexception/ErrorHandler.java
similarity index 90%
rename from spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/ErrorHandler.java
rename to spring-boot-exceptions/src/main/java/com/baeldung/jsonexception/ErrorHandler.java
index b39d2811dd..a890dfa3a2 100644
--- a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/ErrorHandler.java
+++ b/spring-boot-exceptions/src/main/java/com/baeldung/jsonexception/ErrorHandler.java
@@ -1,4 +1,4 @@
-package com.baeldung.passexceptiontoclientjsonspringboot;
+package com.baeldung.jsonexception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
diff --git a/spring-boot-exceptions/src/main/java/com/baeldung/jsonexception/JsonErrorApplication.java b/spring-boot-exceptions/src/main/java/com/baeldung/jsonexception/JsonErrorApplication.java
new file mode 100644
index 0000000000..188584bd7c
--- /dev/null
+++ b/spring-boot-exceptions/src/main/java/com/baeldung/jsonexception/JsonErrorApplication.java
@@ -0,0 +1,13 @@
+package com.baeldung.jsonexception;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class JsonErrorApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(JsonErrorApplication.class, args);
+ }
+
+}
\ No newline at end of file
diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/MainController.java b/spring-boot-exceptions/src/main/java/com/baeldung/jsonexception/MainController.java
similarity index 82%
rename from spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/MainController.java
rename to spring-boot-exceptions/src/main/java/com/baeldung/jsonexception/MainController.java
index 82c0c022a8..5d73c239a4 100644
--- a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/MainController.java
+++ b/spring-boot-exceptions/src/main/java/com/baeldung/jsonexception/MainController.java
@@ -1,4 +1,4 @@
-package com.baeldung.passexceptiontoclientjsonspringboot;
+package com.baeldung.jsonexception;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/resources/application.properties b/spring-boot-exceptions/src/main/resources/application.properties
similarity index 100%
rename from spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/resources/application.properties
rename to spring-boot-exceptions/src/main/resources/application.properties
diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/resources/static/.gitignore b/spring-boot-exceptions/src/main/resources/static/.gitignore
similarity index 100%
rename from spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/resources/static/.gitignore
rename to spring-boot-exceptions/src/main/resources/static/.gitignore
diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/resources/templates/.gitignore b/spring-boot-exceptions/src/main/resources/templates/.gitignore
similarity index 100%
rename from spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/resources/templates/.gitignore
rename to spring-boot-exceptions/src/main/resources/templates/.gitignore
diff --git a/spring-boot-exceptions/src/test/java/com/baeldung/jsonexception/MainControllerIntegrationTest.java b/spring-boot-exceptions/src/test/java/com/baeldung/jsonexception/MainControllerIntegrationTest.java
new file mode 100644
index 0000000000..77e71b7d21
--- /dev/null
+++ b/spring-boot-exceptions/src/test/java/com/baeldung/jsonexception/MainControllerIntegrationTest.java
@@ -0,0 +1,19 @@
+package com.baeldung.jsonexception;
+
+import org.junit.Test;
+
+import com.baeldung.jsonexception.CustomException;
+import com.baeldung.jsonexception.MainController;
+
+public class MainControllerIntegrationTest {
+
+ @Test(expected = CustomException.class)
+ public void givenIndex_thenCustomException() throws CustomException {
+
+ MainController mainController = new MainController();
+
+ mainController.index();
+
+ }
+
+}
\ No newline at end of file
diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/test/java/com/baeldung/passexceptiontoclientjsonspringboot/PassExceptionToClientJsonSpringBootApplicationTests.java b/spring-boot-exceptions/src/test/java/com/baeldung/jsonexception/SpringContextIntegrationTest.java
similarity index 58%
rename from spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/test/java/com/baeldung/passexceptiontoclientjsonspringboot/PassExceptionToClientJsonSpringBootApplicationTests.java
rename to spring-boot-exceptions/src/test/java/com/baeldung/jsonexception/SpringContextIntegrationTest.java
index 5e35c21f4c..aa91e242ab 100644
--- a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/test/java/com/baeldung/passexceptiontoclientjsonspringboot/PassExceptionToClientJsonSpringBootApplicationTests.java
+++ b/spring-boot-exceptions/src/test/java/com/baeldung/jsonexception/SpringContextIntegrationTest.java
@@ -1,4 +1,4 @@
-package com.baeldung.passexceptiontoclientjsonspringboot;
+package com.baeldung.jsonexception;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -7,10 +7,10 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
-public class PassExceptionToClientJsonSpringBootApplicationTests {
+public class SpringContextIntegrationTest {
- @Test
- public void contextLoads() {
- }
+ @Test
+ public void contextLoads() {
+ }
}