as we discussed about circuit breaker module from resilience4j earlier, let's see what Retry module actually offers What is Retry in Resilience4j? this module offers ways of handling failure transaction by automatically retrying those transactions as per properties we configure. let's check how it works in this article. below code shows, how we can add retry annotation to our feign client Note: There is no need to add a fallbackMethod in the @Retry annotation if it is already defined in @CircuitBreaker . @GetMapping("/users/{userId}/albums") @Retry(name="album-service") @CircuitBreaker(name = "album-service", fallbackMethod = "getAlbumsFallbackMethod") public List<AlbumResponseModel> getAlbums(@PathVariable String userId); default List<AlbumResponseModel> getAlbumsFallbackMethod(String userId, Throwable exception) { System.out.println("user id" + userId); System.out.println("exc...
Working with strings is a daily task for Java developers. But if you're still stuck in loops and if-else blocks, it’s time to level up! ๐ช Java Streams offer a clean, expressive, and functional way to process strings—whether you're transforming, filtering, or analyzing them. In this blog, we’ll explore: ๐ ️ Different ways to use streams on strings in Java ๐ผ Popular interview questions involving Java strings and streams Whether you're a beginner or an experienced developer preparing for interviews, this guide has you covered. ✨ Section 1: Different Approaches to Use Streams on Strings in Java Let’s look at how to apply Java Streams on strings using various real-world examples. 1. Convert a String to a List of Characters List<Character> characters = str.chars() .mapToObj(c -> (char) c) .collect(Collectors.toList()); ๐งพ Explanation: str.chars() returns an IntStream of character codes. .mapToObj(c -> (char) c) casts each int...