Spring Data enables you track who modified an entity and when, with just a few annotations.
When combined with Spring Security, you can set this metadata based on the active user.
Continue reading →
Distributed tracing is a method used to profile and monitor applications, especially those built using a microservices architecture.
Distributed tracing helps pinpoint where failures occur and what causes poor performance.
Applied to Kafka Streams it allows us to trace and visualize our messages by propagating diagnostic information within message headers.
Continue reading →
Using the Stream API and the map
method we can transform elements in a stream to another object. Instead of using the map
method we can also write a custom Collector
and transform the elements when we use the collect
method as terminal operation of the stream.
First we have an example where we transform String values using the map
method:
Continue reading →
I have seen the following pattern appear quite a lot:
private String foo(String bar) {
if(bar != null){
return "bar";
}
return null;
}
Here the function is called with a nullable argument, and if the argument was null, the function will return null, and if not it will return a proper value.
I do not like this, and here is why.
Continue reading →
The Kotlin standard library contains a lot of helper functions on top of the Java standard library for our convenience.
Some of those functions help us in converting between different data types.
For example, the String.toInt()
function converts a number formatted as String
to its Int
representation.
But how do we accomplish the same with a Char
? Spoiler alert: NOT by using Char.toInt()
, but by using Char.digitToInt()
!
Continue reading →
Functions defined in Kotlin companion objects are often seen as the 'equivalent' of static methods in Java.
Although there are some similarities, there are also some caveats you should be aware of.
For example, how to use method references (or, to be pedantic: function references) to refer to functions
defined in a companion object.
Continue reading →
Since about a month I’m developing some microservices using Javalin, a small, simple and lightweight web-framework that started as a fork from SparkJava.
By now it’s a ground-up rewrite, influenced by the Javascript framework koa.js.
Don’t let the stuff like Either scare you, we use the Arrow library to make our life a bit more easy :)
When requesting user input from a form, it’s evident that we need to validate our input.
Javalin has its own way of doing so (from the docs):
Continue reading →
Now that it’s clear how to use an OAuth access_token in JWT to perform RBAC inside a REST service playing the role of resource server, it is time to see how to acquire such a token.
Continue reading →