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 […]

Counting active accounts with Metrics

Based on a request parameter in a servlet context Recently I had the task to report active accounts based on http requests. Here I’m going to show you my solution with Dropwizard Metrics. Basically I am using a servlet filter togehter with an counter. Each account has its own counter. So I have a ConcurrentHashMap […]

Update your package dependencies

So why should I update the deps for my application? Keeping your dependencies up-to-date is more important than ever One reason is that if you update the dependencies regularly than you can do painless migrations. Nearly every 6 months major releases of frameworks e.g like angular or react with API breaking changes are available. And such a […]

Workaround – No tests found with Testrunner JUnit 5

Java 8, Eclipse, JUnit 5 & Gradle It seems to be a bug in Eclipse and it’is fixed in the Oxgen Release 3 (4.7.3). But I still have the problem in my Java 8 project. So I did a little trick. I changed the version for the engine and the launcher back to 5.1.0. Now, […]