Skip to content

Commit 3f59bd2

Browse files
Adds Code example for Spring Boot exception Handling tutorial
1 parent e2d6cc3 commit 3f59bd2

File tree

24 files changed

+712
-0
lines changed

24 files changed

+712
-0
lines changed

build-all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ if [[ "$MODULE" == "module5" ]]
8686
then
8787
# ADD NEW MODULES HERE
8888
# (add new modules above the rest so you get quicker feedback if it fails)
89+
build_maven_module "spring-boot/exception-handling"
8990
build_maven_module "spring-boot/spring-boot-elasticsearch"
9091
build_gradle_module "spring-boot/spring-boot-mocking-modules"
9192
build_gradle_module "spring-boot/specification"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Spring Exception handling tutorial
2+
* The code examples in this project showcases various ways to handle exceptions in
3+
a Spring Boot Application
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
plugins {
2+
id 'org.springframework.boot' version '2.4.0'
3+
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
4+
id 'java'
5+
}
6+
7+
group = 'io.reflectoring'
8+
version = '0.0.1'
9+
sourceCompatibility = '11'
10+
11+
configurations {
12+
compileOnly {
13+
extendsFrom annotationProcessor
14+
}
15+
}
16+
17+
repositories {
18+
mavenCentral()
19+
}
20+
21+
dependencies {
22+
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
23+
implementation 'org.springframework.boot:spring-boot-starter-web'
24+
implementation 'org.springframework.boot:spring-boot-starter-validation'
25+
implementation 'org.apache.commons:commons-lang3'
26+
compileOnly 'org.projectlombok:lombok'
27+
runtimeOnly 'com.h2database:h2'
28+
annotationProcessor 'org.projectlombok:lombok'
29+
testImplementation('org.springframework.boot:spring-boot-starter-test') {
30+
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
31+
}
32+
}
33+
34+
test {
35+
useJUnitPlatform()
36+
}
57.8 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Fri Nov 27 17:09:23 IST 2020
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
3+
distributionBase=GRADLE_USER_HOME
4+
distributionPath=wrapper/dists
5+
zipStorePath=wrapper/dists
6+
zipStoreBase=GRADLE_USER_HOME

spring-boot/exception-handling/gradlew

Lines changed: 184 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spring-boot/exception-handling/gradlew.bat

Lines changed: 89 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'exception'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package io.reflectoring.exception;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class ExceptionHandlingApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(ExceptionHandlingApplication.class, args);
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package io.reflectoring.exception.commons;
2+
3+
import lombok.Getter;
4+
5+
@Getter
6+
public enum I18Constants {
7+
NO_ITEM_FOUND("item.absent");
8+
9+
String key;
10+
I18Constants(String key) {
11+
this.key = key;
12+
}
13+
}

0 commit comments

Comments
 (0)