Taking Screenshots With Selenium WebDriver
1. Overview When working with automated tests using Selenium, we often need to take a screenshot of a web page or part of a web page. This can be useful, particularly when debugging test failures or...
View ArticleDivision by Zero in Java: Exception, Infinity, or Not a Number
1. Overview Dividing by zero is an operation that has no meaning in ordinary arithmetic and is, therefore, undefined. In programming, however, while it is often associated with an error, this is not...
View ArticleConfiguring Stack Sizes in the JVM
1. Overview In this quick tutorial, we're going to see how to configure the thread stack sizes in the HotSpot JVM. 2. Default Stack Size Each JVM thread has a private native stack to store call stack...
View ArticleHow Can I Resize an Image Using Java?
1. Introduction In this tutorial, we're going to learn how to resize (scale) an image using Java. We'll explore both core Java and open-source third-party libraries that offer the image resize feature....
View ArticleSetting Up Swagger 2 with a Spring REST API (BAEL-5516)
1. Overview Nowadays, front-end and back-end components often separate a web application. Usually, we expose APIs as a back-end component for the front-end component or third-party app integrations. In...
View ArticleDifferences Between YAML and JSON
1. Overview In this quick article, we'll take a look at the differences between YAML and JSON through quick and practical examples. 2. Format To have a better image, let's start by looking at the JSON...
View ArticleRefer to Environment Variables in pom.xml
1. Overview In this quick tutorial, we're going to see how to read environment variables from Maven‘s pom.xml to customize the build process. 2. Environment Variables To refer to environment variables...
View ArticleMeasuring Object Sizes in the JVM
1. Overview In this tutorial, we're going to see how much space each object consumes in the Java heap. First, we'll get familiar with different metrics to calculate object sizes. Then, we're going to...
View ArticleHow to Resolve a Version Collision of Artifacts in Maven
1. Overview Multi-module Maven projects can have complex dependency graphs. These can have unusual results, the more the modules import from each other. In this tutorial, we'll see how to resolve...
View ArticleJava Weekly, Issue 341
1. Spring and Java >> URL Matching with PathPattern in Spring MVC 5.3 [spring.io] New Spring version, new pattern matching for Request URLs with 8x throughput, and 40% less allocation rate....
View ArticleConverting a Java String Into a Boolean
1. Overview In this tutorial, we'll explore the different ways we can use Java's Boolean class to convert a String into a boolean. 2. Boolean.parseBoolean() Boolean.parseBoolean() allows us to pass in...
View ArticleWhy are Local Variables Thread-Safe in Java
1. Introduction Before we introduced thread-safety, and how it can be achieved. In this article, we'll take a look at local variables and why they are thread-safe. 2. Stack Memory and Threads Let's...
View ArticleRun mvn Command From Another Directory
1. Overview In this quick tutorial, we're going to see how to run the mvn command from any directory outside of the pom.xml. 2. mvn From Another Directory If we run any mvn sub-command from a directory...
View ArticleAdding Text to an Image in Java
1. Overview Sometimes we need to add some text to an image or a set of images. Doing this manually is easy using an image editing tool. But when we want to add the same text in the same way to a...
View ArticleYAML to List of Objects in Spring Boot
1. Overview In this short tutorial, we're going to have a closer look at how to map a YAML list into a List in Spring Boot. We'll first start with some background on how to define lists in YAML. Then,...
View ArticleLoading JDBC Drivers
1. Introduction JDBC is a set of specifications defining the API and SPI parts of the contract for Java Database Connectivity. The standard defines the JDBC driver abstraction as the primary entry...
View ArticleSpring Security vs Apache Shiro
1. Overview Security is a primary concern in the world of application development, especially in the area of enterprise web and mobile applications. In this quick tutorial, we'll compare two popular...
View ArticleConvert an Array of Primitives to a List
1. Overview In this short tutorial, we'll show how to convert an array of primitives to a List of objects of the corresponding type. Typically, we might try to use autoboxing in Java. However, as we're...
View ArticleReading the Value of ‘private’ Fields from a Different Class in Java
1. Overview In this quick tutorial, we'll discuss how can we access the value of a private field from a different class in Java. Before starting with the tutorial, we need to understand that the...
View ArticleRun a Java Main Method in Maven
1. Overview In this short tutorial, we're going to see how to run arbitrary main methods from any Java class using Maven. 2. The exec-maven-plugin Let's suppose we have the following class: public...
View Article