Kotlin

Redis Testcontainer with Kotlin and Spring Boot

I found lots of samples for creating a redis testcontainer in Spring Boot tests. But none of them really worked. Below is a working base class with a sample. It is based on Spring Boot 3.1.2 and latest testcontainer version at time of writing (“org.testcontainers:testcontainers:1.18.3”). The testcontainer-redis versions were avoided on purpose because they were

Redis Testcontainer with Kotlin and Spring Boot 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 »

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 »