Differences in @Valid and @Validated Annotations in Spring
1. Overview In this quick tutorial, we'll focus on the differences between @Valid and @Validated annotations in Spring. Validating users' input is a common functionality in most of our applications. In...
View ArticleJava Weekly, Issue 351
1. Spring and Java >> Java 15 is released! [openjdk.java.net] Java 15, a new Java version packed with new and exciting features, is released: Sealed classes, Pattern matching, Text blocks,...
View ArticleHow to Remove a Prefix From Strings in Groovy
1. Introduction In this quick tutorial, we'll learn how to remove the prefix from a string in Groovy. First, we'll look at what the String class offers for this purpose. After that, we'll move on to...
View ArticleSending Emails with Attachments in Java
1. Overview In this quick tutorial, we'll learn how to send emails with single and multiple attachments in Java using JavaMail API. 2. Project Setup In this article, we're creating a simple Maven...
View ArticleJSON Parameters with Spring MVC
1. Overview In this short tutorial, we're going to take a close look at how to work with JSON parameters in Spring MVC. First, we'll start with a little bit of background on JSON parameters. Then,...
View ArticleSpring Boot Without A Web Server
1. Introduction Spring Boot is a great framework for quickly creating new Java applications for a variety of use cases. One of the most popular uses is as a web server, using one of the many supported...
View ArticleGuide to the System Rules Library
1. Overview Sometimes when writing unit tests, we may need to test code that interacts directly with the System class. Typically in applications such as command-line tools which call System.exit...
View ArticleReducing JSON Data Size
1. Introduction Java applications often use JSON as a common format for sending and receiving data. Moreover, it's used as a serialization protocol for storing data. With smaller JSON data sizes, our...
View ArticleChecking If a Method is Static Using Reflection in Java
1. Overview In this quick tutorial, we'll discuss how we can check if a method is static or not in Java by using the Reflection API. 2. Example To demonstrate this, we'll create StaticUtility class,...
View ArticleDoes a Method’s Signature Include the Return Type in Java?
1. Overview The method signature is only a subset of the entire method definition in Java. Thus, the exact anatomy of the signature may cause confusion. In this tutorial, we'll learn the elements of...
View ArticleDifference Between run, cmd and entrypoint in a Dockerfile
1. Overview In a Dockerfile, we often encounter instructions like run, cmd, or entrypoint. At first glance, they are all used for specifying and running commands. But what's the difference between...
View ArticleGet the First Key and Value From a HashMap
1. Overview In this tutorial, we'll discuss how to get the first key-value pair from a HashMap without knowing the key. First, we'll use an iterator, and then a stream to get the first entry. Finally,...
View ArticleCharacterEncodingFilter In SpringBoot
1. Overview In this article, we'll learn about CharacterEncodingFilter and it's usage in a Spring Boot application. 2. CharacterEncodingFilter CharacterEncodingFilter is a servlet filter that helps us...
View ArticleListing the Available Cipher Algorithms
1. Overview In this quick tutorial, we'll learn about the Cipher class in Java. Then, we'll see how to list the available cipher algorithms and their providers. 2. The Cipher Class The Cipher class,...
View ArticleJava Weekly, Issue 352
1. Spring and Java >> Announcing Tribuo, a Java Machine Learning library [blogs.oracle.com] Meet Tribuo: A ML library written in Java supporting classification, clustering, anomaly detection, and...
View ArticleGuide to the Gradle Wrapper
1. Overview Gradle is commonly used by developers to manage their project's build lifecycle. It's the default choice of build tool for all new Android projects. In this tutorial, we'll learn about...
View ArticleHow to Set TLS Version in Apache HttpClient
1. Introduction Apache HttpClient is a low-level, lightweight client-side HTTP library for communicating with HTTP servers. In this tutorial, we'll learn how to configure the supported Transport Layer...
View ArticleFind the Last Modified File in a Directory with Java
1. Overview In this quick tutorial, we're going to take a close look at how to find the last modified file in a specific directory in Java. First, we'll start with the legacy IO and the modern NIO...
View ArticleThe Difference Between a.getClass() and A.class in Java
1. Overview In Java, the class java.lang.Class is the entry point of all reflection operations. Once we have an object of java.lang.Class, we can then call the corresponding methods to get the objects...
View ArticleReversing a Linked List in Java
1. Introduction In this tutorial, we'll implement two linked list reversal algorithms in Java. 2. Linked List Data Structure A linked list is a linear data structure in which a pointer in each element...
View Article