Browsed by
Tag: kotlin

Java/Kotlin Unit Testing – Test Stdout/Stderr/Logs

Java/Kotlin Unit Testing – Test Stdout/Stderr/Logs

Note: see also my old blog post if you want a more complex solution 😉 It targets at replacing the log appender. The below described method is simpler (nice!), it just listens in on ALL standard output+errors. When using spring-boot unit testing (library spring-boot-test-2.6.2.jar or newer), you can capture the output as send to the standard out and standard error channels. This allows for example testing output to log statements (by sending logs to stdout / console appender). From the…

Read More Read More

Maven Version Plugin Automatic Updates

Maven Version Plugin Automatic Updates

Whenever you edit a Java/Kotlin maven project, you should see if you need to update any used libraries. For this purpose, I have a bash alias command which runs the next three statements in a row: The full alias line looks like this (in ~/.bash_aliased) Note: it seems the plug-in is not perfect 😉 Sometimes it does major updates, even if you ask it not to. So always carefully look at the changes which are made! The URL as used…

Read More Read More

Lombok SonarQube Config

Lombok SonarQube Config

To skip code which is generated by Lombok in the SonarQube code checks, create a file “lombok.config” in your Java/Kotlin maven project, with these two lines in it: The addLombokGeneratedAnnotation setting does the trick…

Netty Cache Thread Memory Issues

Netty Cache Thread Memory Issues

When running spring-boot using netty (we ran: 4.1.69), and async code, your server might run into a memory issue after running for a while. In our case we were using spring-cloud-gateway (we ran: 3.0.5), and after two weeks of running, we started hitting long garbage collection times. To get around this, we did multiple code fixes, amongst one was disabling the thread-local caches for non-netty threads. To do this, add JVM option: For an explanation, see: https://github.com/spring-projects/spring-framework/issues/21174 Quote: The PooledByteBufAllocator…

Read More Read More