Datadog + Spring Boot QuickStart

First things first, we can generate the starter project using https://start.spring.io/. Select these dependencies: Then, using documentation here we should set API Key, Application Key and Datadog URI in application.properties file: You can get your API Key and Datadog URI from startup Datadog screen: By the way, Datadog has a trial period. Application Key can […]

READ MORE

Accessing Spring Boot Actuator metrics programmatically

Suppose you have Spring Boot actuator in your application, and you want to access metrics programmatically. Or you want to gather a lot of system/application metrics initially. After you enable the Spring Boot actuator in your application (https://www.baeldung.com/spring-boot-actuators), just autowire all actuator auto wire candidates: You can use them like this: That’s all.

READ MORE

Java 8 date/time type not supported

Suppose you want to serialize some object to JSON. You may encounter the exception: We need to do two steps: Firstly, let’s add dependency from https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310. Next, let’s register JavaTimeModule within ObjectMapper: If you working with Spring or with some other framework, ObjectMapper can be instantiated implicitly. You need to override instantiation by yourself. For […]

READ MORE

No implementation of L32X64MixRandom

You may encounter exception, that states: The reason is JDK/JRE version and vendor. I noticed, that at least JBR-17 (JetBrains Runtime) hasn’t got L32X64MixRandom algorithm. You may want to switch to Azul-17 (Azul Zulu) to make it works again. If you build/run your application with Gradle, don’t forget to change Gradle JVM version in IntelliJ […]

READ MORE

Spring TCP server

Let’s suppose that you need configure a TCP server in Spring / Spring Boot application. We will make it that the server prints the client’s request on the screen, then sends a response to the client. First, let’s include the spring-integration-ip dependency. In Maven it will look like this: Like gRPC ideology, in this case […]

READ MORE

How to immediately terminate the Spring Boot Yarn container with an error

Imagine an error or exception occurs while running the Spring Boot Yarn container, and we need to kill container from itself and return an error code. You can use @OnContainerStart annotation as mentioned in this article: https://mchesnavsky.tech/how-to-set-up-exit-code-on-spring-boot-yarn-container. But if we need to stop the container immediately, we just need to call: – where parameter is […]

READ MORE