Skip to content

Instantly share code, notes, and snippets.

@up1
Last active August 18, 2025 15:15
Show Gist options
  • Select an option

  • Save up1/d91459138c607c33c2c8b1953584616a to your computer and use it in GitHub Desktop.

Select an option

Save up1/d91459138c607c33c2c8b1953584616a to your computer and use it in GitHub Desktop.
Spring framework 7 and Spring Boot 4
@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(...);
}
}
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;
}
}
@RestController
public class DemoController {
@GetMapping(value = "/hi", version = "1")
public String v1(){
return "V1";
}
@GetMapping(value = "/hi", version = "2")
public String v2(){
return "V2";
}
}
@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