Stub Getter and Setter in Mockito
1. Introduction While Mockito provides an excellent way to avoid initializing objects we don’t want to initialize, sometimes its out-of-the-box functionality is limiting. In this tutorial, we’ll...
View ArticleJava Weekly, Issue 586 – Java 24 is here!
1. Spring and Java >> Java 24 Rolls Out Today! Find Out Why It’s Aptly Named [foojay.io] Java 24 is here with exactly 24 JEPs :). Let’s have a closer look at the new features and changes it adds,...
View ArticleSend and Receive Serialized Object in Socket Channel
1. Introduction In this tutorial, we’ll explore how to send and receive serialized objects using Java’s SocketChannel from the java.nio package. This approach enables efficient, non-blocking network...
View ArticleManagement Interface in Quarkus
1. Introduction As cloud technologies evolve, deploying and managing applications has become more seamless. However, this shift has also increased the need for robust operational data to monitor and...
View ArticleSession/Cookie Management in Apache JMeter
1. Introduction In this tutorial, we’ll learn how JMeter manages sessions and cookies, set up a test plan that logs in to an application, accesses protected resources, and logs out. Along the way,...
View ArticleMocking JDBC for Unit Testing
1. Overview In this tutorial, we’ll discuss testing code that uses JDBC objects to interact with the database. Initially, we’ll use Mockito to stub all the java.sql objects involved in acquiring a JDBC...
View ArticleIntroduction to OSHI
1. Overview In this tutorial, we’ll learn something interesting that could help us know our system. Whenever we think about checking CPU usage, memory status, or disk space in Java, we might ask...
View ArticleReusing a PreparedStatement Multiple Times in Java
1. Overview In this tutorial, we’ll be looking at how to use PreparedStatements efficiently. A PreparedStatement is an object that stores a precompiled SQL statement for us. We can then use this object...
View ArticleJava Naming Conventions
1. Overview In this tutorial, we explore the essential Java naming conventions that help us write clear, maintainable, and consistent code. Adopting these conventions is crucial for reducing ambiguity...
View ArticleMonitor Non-Heap Memory Usage of a JVM
1. Overview Using a Java application, we sometimes face issues with memory consumption. In general, we can categorize all problems into those based on heap memory usage and those based on non-heap...
View ArticleClosing Scanner in Java
1. Introduction When we use Java’s Scanner class to read input from System.in, some IDEs may warn about a potential resource leak. For instance, if we don’t explicitly close the Scanner we may face a...
View ArticleOpen Multiple Projects in the Same Window in IntelliJ IDEA
1. Introduction Nowadays, working with multiple projects is very common. Opening multiple instances of the IDE for each project isn’t very convenient and also consumes a lot of system resources. In...
View ArticleJava Weekly, Issue 587
1. Spring and Java >> Performance Improvements in JDK 24 [inside.java] The “under-the-hood” changes in JDK 24 are easy to miss among all the new features and improvements. Take a look at a...
View ArticleOutput the Version Number to a Text File Using Maven
1. Overview In Maven-based Java projects, outputting the project version number to a text file is often necessary. This is useful for version tracking, logging, and ensuring consistency across...
View ArticleIntegrating WireMock with Spring Boot
1. Introduction Testing external dependencies such as REST APIs can be challenging when developing web applications. Making network calls is slow and unreliable, as third-party services might be...
View ArticleEnableEurekaClient vs EnableDiscoveryClient: Which to Use?
1. Introduction In this tutorial, we’ll examine what distinguishes @EnableEurekaClient from @EnableDiscoveryClient. Both are annotations used when working with the service registry in Spring Boot while...
View ArticleJava API for GitHub using GitHub-API
1. Introduction In this article, we’re going to have a look at the GitHub API For Java library. This provides us with an object-oriented representation of the GitHib API, allowing us to easily interact...
View ArticleConnect Java Spring Boot to Db2 Database
1. Overview IBM Db2 is a cloud-native, relational database system that also supports semi-structured data such as JSON and XML. It’s designed to handle large volumes of data at low latency. In this...
View ArticleJava Weekly, Issue 588
1. Spring and Java >> Doing away with SELECT NEW [in.relation.to] Hibernate 6 simplifies the syntax for returning a subset of attributes into a Java class. This is also a proposal for the Jakarta...
View ArticleSynchronous Communication With Apache Kafka Using ReplyingKafkaTemplate
1. Overview Apache Kafka has established itself as one of the most popular and widely used messaging systems for building event-driven architectures, where one microservice publishes a message to a...
View Article