Archive: March 2022

Major migrations made easy with OpenRewrite

Posted on by  
Tim te Beek

OpenRewrite enables large-scale distributed source code refactoring for framework migrations, vulnerability patches, and API migrations with an early focus on the Java language.

— Introduction to OpenRewrite
https://docs.openrewrite.org

To demonstrate OpenRewrite, this blogpost will walk through upgrading a Spring Boot 1.5 application to 2.5+. Along the way we will pick up JUnit 5, and migrate from Java 8 to 17, with minimal manual intervention.

We’ll start with the Spring PetClinic Sample Application, back as it was almost five years ago in 2017!

Continue reading →

Let's talk functions

Posted on by  
Jacob van Lingen

Cologne. Anno Domini 1470. For over two hundred years German craftsmen have been working on the cathedral close the Rhine. At the very moment, master Tilman is busy decorating one of the pillars in the left center of the nave. He has done this profession for his entire live. His hands carve a figure from a grey stone. First the baby Jesus emerges. Then a head, a body and finally the feet of a man come into view. It is the saint Christopher. According to legend, together with the divine child this saint carries the burden of the entire world. It is a marvel to watch the skilled worker chisel a man from rock. And yet, if you watch him closely, you start to wonder if he really has to use his old tools. Wouldn’t he do his job even better with new shiny gear? Does the veteran artisan really know all the tricks, or could even he learn something new?

Continue reading →

Fault Tolerance in Quarkus

Posted on by  
Justus Brugman

Yet another short post using Quarkus. Quarkus is a full-stack, Kubernetes-native Java framework, but for this short post I’m using Kotlin for a change. The goal of this post is to show you how easy it is to use the circuit-breaker pattern to build fault tolerant services. For this we use the smallrye-fault-tolerance library, an implementation of the Eclipse MicroProfile Fault Tolerance.

Continue reading →

DataWeave Delight: Wrapping string values

Posted on by  
Hubert Klein Ikkink

If we want to wrap a string value with another string value we can use the wrapWith and wrapIfMissing functions defined in the dw::core::Strings module. The first argument of these functions is the string we want to wrap and the second argument is the string value that wraps the first argument. The function wrapIfMissing will only apply the wrapper string if it was not already applied.

To remove a wrapped character from a wrapped string we can use the unwrap function. The first argument is the string value that is already wrapped and the second argument the character we want to use for unwrapping. The second argument can only be a single character, but we can repeatedly invoke the unwrap function to remove multiple wrap characters.

Continue reading →

DataWeave Delight: Finding highest or lowest value in an array

Posted on by  
Hubert Klein Ikkink

DataWeave has several function to find the highest or lowest value in an array. The items in the array need to be of the same type and implement the Comparable interface. To find the highest value we can use the max function. The function returns the maximum value based on the type of the item in the array. If we want to find the highest value based on other criteria we can use the maxBy function. This function takes a lambda as last argument where we can return a Comparable value that is used to determine the highest value. To find the lowest value in an array we have similar functions: min and minBy.

Continue reading →

shadow-left