Last active
August 18, 2025 15:15
-
-
Save up1/d91459138c607c33c2c8b1953584616a to your computer and use it in GitHub Desktop.
Spring framework 7 and Spring Boot 4
This file contains hidden or 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
| @EnableResilientMethods | |
| class Demo { | |
| // 5 retry attempts and an exponential back-off strategy with a bit of jitter | |
| @Retryable(maxAttempts = 5, delay = 100, jitter = 10, multiplier = 2, maxDelay = 1000) | |
| public void sendNotification() { | |
| this.jmsClient.destination("notifications").send(...); | |
| } | |
| // | |
| @ConcurrencyLimit(10) | |
| public void sendNotification() { | |
| this.jmsClient.destination("notifications").send(...); | |
| } | |
| } |
This file contains hidden or 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
| import org.jspecify.annotations.NonNull; | |
| import org.jspecify.annotations.Nullable; | |
| public class Demo { | |
| private String name; | |
| public void setName(@NonNull String name) { | |
| this.name = name; | |
| } | |
| @Nullable | |
| public String getName() { | |
| return this.name; | |
| } | |
| } |
This file contains hidden or 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
| @RestController | |
| public class DemoController { | |
| @GetMapping(value = "/hi", version = "1") | |
| public String v1(){ | |
| return "V1"; | |
| } | |
| @GetMapping(value = "/hi", version = "2") | |
| public String v2(){ | |
| return "V2"; | |
| } | |
| } |
This file contains hidden or 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
| @Configuration | |
| public class WebConfiguration implements WebMvcConfigurer { | |
| @Override | |
| public void configureApiVersioning(ApiVersionConfigurer configurer) { | |
| configurer.useRequestParam("version"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment