Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dfbc044

Browse filesBrowse files
committed
MethodArgumentResolver example
1 parent 71d2a32 commit dfbc044
Copy full SHA for dfbc044

File tree

Expand file treeCollapse file tree

14 files changed

+516
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

14 files changed

+516
-0
lines changed
Open diff view settings
Collapse file
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
HELP.md
2+
.gradle
3+
build/
4+
!gradle/wrapper/gradle-wrapper.jar
5+
!**/src/main/**
6+
!**/src/test/**
7+
8+
### STS ###
9+
.apt_generated
10+
.classpath
11+
.factorypath
12+
.project
13+
.settings
14+
.springBeans
15+
.sts4-cache
16+
17+
### IntelliJ IDEA ###
18+
.idea
19+
*.iws
20+
*.iml
21+
*.ipr
22+
out/
23+
24+
### NetBeans ###
25+
/nbproject/private/
26+
/nbbuild/
27+
/dist/
28+
/nbdist/
29+
/.nb-gradle/
30+
31+
### VS Code ###
32+
.vscode/
Collapse file
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
plugins {
2+
id 'org.springframework.boot' version '2.2.5.RELEASE'
3+
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
4+
id 'java'
5+
}
6+
7+
group = 'io.reflectoring'
8+
version = '0.0.1-SNAPSHOT'
9+
sourceCompatibility = '11'
10+
11+
repositories {
12+
mavenCentral()
13+
}
14+
15+
dependencies {
16+
implementation 'org.springframework.boot:spring-boot-starter'
17+
implementation 'org.springframework.boot:spring-boot-starter-web'
18+
testImplementation('org.springframework.boot:spring-boot-starter-test') {
19+
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
20+
}
21+
22+
compileOnly 'org.projectlombok:lombok'
23+
annotationProcessor 'org.projectlombok:lombok'
24+
}
25+
26+
test {
27+
useJUnitPlatform()
28+
}
Collapse file

‎spring-boot/argumentresolver/gradlew‎

Copy file name to clipboardExpand all lines: spring-boot/argumentresolver/gradlew
+172Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎spring-boot/argumentresolver/gradlew.bat‎

Copy file name to clipboardExpand all lines: spring-boot/argumentresolver/gradlew.bat
+84Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'argumentresolver'
Collapse file
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package io.reflectoring.argumentresolver;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class ArgumentresolverApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(ArgumentresolverApplication.class, args);
11+
}
12+
13+
}
Collapse file
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.reflectoring.argumentresolver;
2+
3+
import org.springframework.http.ResponseEntity;
4+
import org.springframework.web.bind.annotation.ControllerAdvice;
5+
import org.springframework.web.bind.annotation.ExceptionHandler;
6+
import org.springframework.web.client.HttpStatusCodeException;
7+
8+
@ControllerAdvice
9+
class ErrorHandler {
10+
11+
@ExceptionHandler(HttpStatusCodeException.class)
12+
ResponseEntity<?> handleHttpStatusCodeException(HttpStatusCodeException e) {
13+
return ResponseEntity.status(e.getStatusCode()).build();
14+
}
15+
16+
}
Collapse file
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package io.reflectoring.argumentresolver;
2+
3+
import org.springframework.http.HttpStatus;
4+
import org.springframework.web.client.HttpStatusCodeException;
5+
6+
public class NotFoundException extends HttpStatusCodeException {
7+
8+
protected NotFoundException() {
9+
super(HttpStatus.NOT_FOUND);
10+
}
11+
}
Collapse file
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.reflectoring.argumentresolver;
2+
3+
4+
import lombok.Value;
5+
6+
@Value
7+
public class Repository {
8+
9+
private final Long id;
10+
private final String slug;
11+
12+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.