Spring Boot WebClient with request logging

RestTemplate is dead and everybody should use WebClient now. That’s what you find everywhere so I had a look how to configure an instance of WebClient properly: This defines a bean genericWebClient with Spring Boot configured Jackson ObjectMapper instance. Here is also the code for the WebClientLoggerBuilder: This simply logs method, path and headers of …

Spring Boot WebClient with request logging Read More »

java.lang.ClassNotFoundException: javax.annotation.PostConstruct

When upgrading to the latest tools and libraries in a Spring Boot application with OpenAPI code generator in place the OpenAPI Kotlin generator introduced jakarta.annotation:jakarta.annotation-api. But with this in place the application refused to start with something like org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat…Caused by: java.lang.IllegalStateException: …

java.lang.ClassNotFoundException: javax.annotation.PostConstruct Read More »

REST & JSON basics

For REST is a very good source to start reading and a guideline for JSON can be found under

ArrayIndexOutOfBounds with Kotlin coroutines and Hibernate-Validator

I was trying to build a spring boot application based on spring spring-boot-starter-webflux which is based on kotlinx-coroutines-reactor. The API definition was done with OpenAPI-Generator with “kotlin-spring” generator and “spring-boot” library. Setting the configOptions useBeanValidation and reactive to true generates suspendable methods and uses webflux. And adding hibernate-validator allows to use bean validation for every …

ArrayIndexOutOfBounds with Kotlin coroutines and Hibernate-Validator Read More »

Delegate value initialisation with “by lazy” in Kotlin

Using unmodifiable variables – so called values in Kotlin with keyword val – should be the default where possible but it’s not always practical to initialise all values within the constructor. Kotlin offers the option to use “by lazy”. With some common kinds of properties, even though you can implement them manually every time you …

Delegate value initialisation with “by lazy” in Kotlin Read More »

Lombok and log4shell

Project lombok has become a defacto standard in close to every Java project I see. Because of this I want to also write about the ongoing log4j problems as described under The annotation @Log4j allows to create a log4j logger field in the annotated class. This of course implicates that your project is using …

Lombok and log4shell Read More »