Detecting If a Spring Transaction Is Active
1. Overview Detecting transactions could be useful for audit purposes or for dealing with a complex code base where good transaction conventions weren't implemented. In this brief tutorial, we'll go...
View ArticleFinding a Free Port in Java
1. Overview When starting a socket server in our Java application, the java.net API requires us to specify a free port number to listen on. The port number is required so that the TCP layer can...
View ArticleGetting Database URL From JDBC Connection Object
1. Overview In this quick tutorial, we'll discuss how we can get the database URL from a JDBC Connection object. 2. Example Class To demonstrate this, we'll create a DBConfiguration class with a method...
View ArticleApache Spark: Differences between Dataframes, Datasets and RDDs
1. Overview Apache Spark is a fast, distributed data processing system. It does in-memory data processing and uses in-memory caching and optimized execution resulting in fast performance. It provides...
View ArticleGuide to Jenkins Parameterized Builds
1. Introduction Jenkins is one of the most popular CI/CD tools in use today. It allows us to automate every aspect of the software lifecycle, from building all the way to deploying. In this tutorial,...
View ArticleObject States in Hibernate’s Session
1. Introduction Hibernate is a convenient framework for managing persistent data, but understanding how it works internally can be tricky at times. In this tutorial, we'll learn about object states and...
View ArticleConstants in Java: Patterns and Anti-Patterns
1. Introduction In this article, we're going to learn about using constants in Java with a focus on common patterns and anti-patterns. We'll start with some basic conventions for defining constants....
View ArticlePerformance of removeAll() in a HashSet
1. Overview HashSet is a collection for storing unique elements. In this tutorial, we'll discuss the performance of the removeAll() method in the java.util.HashSet class. 2. HashSet.removeAll() The...
View ArticleHow to Import a .cer Certificate Into a Java KeyStore
1. Overview A KeyStore, as the name suggests, is basically a repository of certificates, public and private keys. Moreover, JDK distributions are shipped with an executable to help manage them, the...
View ArticleJava Weekly, Issue 356
1. Spring and Java >> JEP proposed to target JDK 16: Unix-Domain Socket Channels [mail.openjdk.java.net] More channels for NIO: Java 16 will support Unix domain sockets as part of its NIO...
View ArticleIntroduction to Netflix Mantis
1. Overview In this article, we'll take a look at the Mantis platform developed by Netflix. We'll explore the main Mantis concepts by creating, running, and investigating a stream processing job. 2....
View ArticleAccessing Keycloak Endpoints Using Postman
1. Introduction In this article, we start with a quick review of OAuth 2.0, OpenID, and Keycloak. Afterward, we'll learn about the Keycloak REST APIs and how to call them in Postman. 2. OAuth 2.0 OAuth...
View ArticleGet Names of Classes Inside a JAR File
1. Overview Most Java libraries are available as JAR files. In this tutorial, we'll address how to get names of classes inside a given JAR file from the command line and from a Java program. Then,...
View ArticleRetrofit 2 – Dynamic URL
1. Overview In this short tutorial, we'll learn how to create a dynamic URL in Retrofit2. 2. @Url Annotation There are cases when we need to use a dynamic URL in our application during runtime. Version...
View ArticleSet JWT with Spring Boot and Swagger UI
1. Introduction In this short tutorial, we're going to see how to configure Swagger UI to include a JSON Web Token (JWT) when it calls our API. 2. Maven Dependencies In this example, we'll be using...
View ArticleJava Weekly, Issue 357
1. Spring and Java >> The JPA and Hibernate first-level cache [vladmihalcea.com] On the benefits of the first-level cache in JPA/Hibernate: write-behind cache, batching, and application-level...
View ArticleDependency Management in Gradle
1. Overview In this tutorial, we'll look at declaring dependencies in a Gradle build script. For our examples, we'll be using Gradle 6.7. 2. Typical Structure Let's start with a simple Gradle script...
View ArticleApache Commons Collections vs Google Guava
1. Overview In this tutorial, we'll compare two Java-based open source libraries: Apache Commons and Google Guava. Both libraries have a rich feature set with lots of utility APIs majorly in the...
View ArticleStoring Files Indexed by a Database
1. Overview When we are building some sort of content management solution, we need to solve two problems. We need a place to store the files themselves, and we need some sort of database to index them....
View ArticleAbstractMethodError in Java
1. Overview Sometimes, we may encounter AbstractMethodError at runtime in our application. If we don't know this error well, it might take a while to determine the cause of the problem. In this...
View Article