Merge pull request #6823 from eugenp/BAEL-2892-v2
refactor module spring-boot-ex
This commit is contained in:
commit
f97e1f3c2c
3
pom.xml
3
pom.xml
|
@ -628,6 +628,7 @@
|
|||
<module>spring-boot-custom-starter</module>
|
||||
<module>spring-boot-disable-console-logging</module>
|
||||
<!-- <module>spring-boot-gradle</module> --> <!-- Not a maven project -->
|
||||
<module>spring-boot-exceptions</module>
|
||||
<module>spring-boot-jasypt</module>
|
||||
<module>spring-boot-keycloak</module>
|
||||
<module>spring-boot-logging-log4j2</module>
|
||||
|
@ -825,6 +826,7 @@
|
|||
<module>spring-boot-client</module>
|
||||
<module>spring-boot-configuration</module>
|
||||
<module>spring-boot-custom-starter</module>
|
||||
<module>spring-boot-exceptions</module>
|
||||
<module>greeter-spring-boot-autoconfigure</module>
|
||||
<module>greeter-spring-boot-sample-app</module>
|
||||
<module>persistence-modules/spring-boot-h2/spring-boot-h2-database</module>
|
||||
|
@ -1286,6 +1288,7 @@
|
|||
<module>spring-boot-ctx-fluent</module>
|
||||
<module>spring-boot-custom-starter</module>
|
||||
<module>spring-boot-disable-console-logging</module>
|
||||
<module>spring-boot-exceptions</module>
|
||||
<!-- <module>spring-boot-gradle</module> --> <!-- Not a maven project -->
|
||||
<module>spring-boot-jasypt</module>
|
||||
<module>spring-boot-keycloak</module>
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.4.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>pass-exception-to-client-json-spring-boot</artifactId>
|
||||
<version>0.0.4-SNAPSHOT</version>
|
||||
<name>pass-exception-to-client-json-spring-boot</name>
|
||||
<description>Baeldung article code on how to pass exceptions to client in JSON format using Spring Boot</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>spring-boot-exceptions</artifactId>
|
||||
<version>0.0.4-SNAPSHOT</version>
|
||||
<name>pass-exception-to-client-json-spring-boot</name>
|
||||
<description>Baeldung article code on how to pass exceptions to client in JSON format using Spring Boot</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.passexceptiontoclientjsonspringboot;
|
||||
package com.baeldung.jsonexception;
|
||||
|
||||
public class CustomException extends RuntimeException {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.passexceptiontoclientjsonspringboot;
|
||||
package com.baeldung.jsonexception;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.passexceptiontoclientjsonspringboot;
|
||||
package com.baeldung.jsonexception;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.passexceptiontoclientjsonspringboot;
|
||||
package com.baeldung.jsonexception;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
|||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class PassExceptionToClientJsonSpringBootApplicationTests {
|
||||
public class SpringContextIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
Loading…
Reference in New Issue