Archive by Author

Test your code not throwing any exception

with JUnit and Assertj Recently I had to test that the code does not throw any exception. We all know that AssertJ gives us a powerful set of assertions which improves your test code readability. And again, AssertJ helped me to do the job with assertThatCode: You can find more assertions example on github. I […]

Id Software – Programming Principles

Produce constantly shippable codebase I had the chance to see John Romero at a conference. He talked about the Id Software programming principles. They defined these rules through experience. Each is built upon one another, so it’s a unique methodology and which helps you to produce constantly shippable codebase. You know these rules, but I […]

Spring Actuator Metrics availableTags

Get useful metrics to monitor your app With Spring Actuator API several useful metrics can be exposed that you can use to monitor your Spring Boot application. Metrics like application health or the last HTTP requests. I’ll show you how to do that. I’ve made an example project you can found at https://github.com/claudioaltamura/docker-springboot-helloworld. After starting […]

Format code like google

Get easy look-alike readable code with IntelliJ Spotless is are really cool tool for formatting your code with build tools. If you like, you can do that with your IDE too. I show your how to configure IntelliJ, so your code is automatically formatted while you save a file. First you have to install the […]

Discover updates or vulnerabilities

Keep your dependencies up-to-date with gradle This is an import task, e.g. nearly every 6 months major releases of frameworks are available or new vulnerabilities are found on a daily basis. I’ll show you two gradle plugins which helps you that your software project won’t be left behind. The first one is gradle-version-plugin. This plugin […]

Never write in Java a getter or equals method again

The lombok project helps you to be more productive Lombok is a great tool. Your code often gets verbose for common tasks. So what does lombok? The framework is plugged into the build process. It autogenerates bytecode into your class fields through a couple of annotations. Here comes the build.gradle: So let’s have a look […]

Trace http requests with Spring Actuator

List the last http request with ease Spring Actuator provides also a httptrace endpoint. You get the last HTTP request with /httptrace. After adding Spring Boot Actuator dependencies to your project dependencies, you have to expose the httptrace endpoint via your application.properties: In Spring Boot 2.0 the trace endpoint was renamed to httptrace. You can […]

Change your application log level with Spring Actuator

You can do it even at runtime 🙂 Spring Boot provides a loggers actuator endpoint for viewing and changing log levels at runtime. What do I need? Add the Spring Boot Starter Actuator to you pom.xml or build.gradleorg.springframework.boot:spring-boot-starter-actuator Expose at least the loggers endpoint in your application.propertiesmanagement.endpoints.web.exposure.include=loggers When exposed, you get all loggers details with /loggers: […]

Creating a generic array in Java

Generic array initialization Recently I work with CompletableFutures. I used the allOf method which takes a varargs as input. Based on the request, a couple of things had to be processed. So how do I create a generic array that I could use at CompletableFuture.allof()? Array.newInstance together with toArray() does the trick. This is my […]

Echo your REST calls with a echo service

Echo services are a simple tool for developing and testing When you implement a service are often in a situation where you have to call another web service, for example service B. And to complicate the situation, service B is not fully implemented or even not available. Than an echo service could make sense for […]

Consent Management Platform von Real Cookie Banner