When trying to set up alerting for Spring Boot services with Prometheus, I discovered the synthetic "up" time series which is great for checking whether the monitoring system can reach my service instances. While this is a great thing, I also wanted to alert on the health status of my …
read moreOther articles
Spring Boot: Logging Failed Logins
In many applications it's important to react to failed logins and other security-critical events, for example to log the failed login attempt to a file or to display a captcha after repeated failures. Spring-based applications come with a simple mechanism to access this kind of information using Application Events.
Spring's …
read moreEmpty InputStream with Spring MVC
The other day, I was trying to build a simple batch upload interface for a Java web application running Spring Boot with Spring MVC on Apache Tomcat. But when I tried reading the InputStream in my controller, it was always empty. Fortunately, this turned out to be quite easy to …
read moreResolving JARs
Sometimes it's useful to check whether a local JAR file is available from Maven Central, for example when converting an old build system to Maven. In many old systems, JARs aren't named consistently and versioning info isn't available. Fortunately, Maven Central has a search interface that supports lookup by a …
read moreNormalizing Text in Java
Once in a while I see misguided attempts at normalizing text to make it suitable for use in URLs, file names, or other situations where a plain ASCII representation is desired. This can be tricky but with Java's excellent Unicode support and some background knowledge it is pretty easy to …
read moreInstalling Oracle's JDK on Debian/Ubuntu
Due to licensing issues, Linux distributions don't ship Oracle Java packages anymore. In many cases, that doesn't matter since you can just use OpenJDK. But if you do need Oracle's JDK, Debian packages are a bit more convenient than handling tarballs because they integrate nicely with the rest of the …
read moreMaven: Discovering Dependency Conflicts
Among other things, Maven's dependency plugin displays the result of Maven's dependency resolution mechanism. The output of the dependency:tree goal makes it easy to see where transitive dependencies come from. This week I discovered that recent versions of the plugin also support a verbose flag that lists conflicts and …
read moreTesting equals() with Guava
I've long held the opinion that Guava belongs on every Java classpath because its design and the quality of its implementation surpass other comparable utility libraries (and sometimes even the JDK). Guava's testlib is pretty cool, too, even though it's not as widely known.
Most things in testlib are useful …
read moreVisualizing Package Dependencies
Managing module or package dependencies is an important design activity that helps to keep a software project maintainable. Visualizing these dependencies is a good way of getting a first impression on a project and for exposing design problems. In this article we're going to create a basic visualization for a …
read more