-
-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
ThreadLocalAccessor
in Spring Boot 3 WebFlux sample (#2569)
- Loading branch information
Showing
18 changed files
with
308 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...io/sentry/samples/spring/boot/Person.java → ...y/samples/spring/boot/jakarta/Person.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...samples/spring/boot/PersonController.java → ...spring/boot/jakarta/PersonController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ry/samples/spring/boot/PersonService.java → ...es/spring/boot/jakarta/PersonService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9
...es/spring/boot/SentryDemoApplication.java → ...g/boot/jakarta/SentryDemoApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
package io.sentry.samples.spring.boot; | ||
package io.sentry.samples.spring.boot.jakarta; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.web.reactive.function.client.WebClient; | ||
|
||
@SpringBootApplication | ||
public class SentryDemoApplication { | ||
public static void main(String[] args) { | ||
SpringApplication.run(SentryDemoApplication.class, args); | ||
} | ||
|
||
@Bean | ||
WebClient webClient(WebClient.Builder builder) { | ||
return builder.build(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/Todo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.sentry.samples.spring.boot.jakarta; | ||
|
||
public class Todo { | ||
private final Long id; | ||
private final String title; | ||
private final boolean completed; | ||
|
||
public Todo(Long id, String title, boolean completed) { | ||
this.id = id; | ||
this.title = title; | ||
this.completed = completed; | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public boolean isCompleted() { | ||
return completed; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...t-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.sentry.samples.spring.boot.jakarta; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.reactive.function.client.WebClient; | ||
import reactor.core.publisher.Mono; | ||
|
||
@RestController | ||
public class TodoController { | ||
private final WebClient webClient; | ||
|
||
public TodoController(WebClient webClient) { | ||
this.webClient = webClient; | ||
} | ||
|
||
@GetMapping("/todo-webclient/{id}") | ||
Mono<Todo> todoWebClient(@PathVariable Long id) { | ||
return webClient | ||
.get() | ||
.uri("https://jsonplaceholder.typicode.com/todos/{id}", id) | ||
.retrieve() | ||
.bodyToMono(Todo.class) | ||
.map(response -> response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.