Get the Running Port in Spring Boot
1. Overview A Spring Boot application embeds a web server, and sometimes, we may want to discover the HTTP port at runtime. In this tutorial, we'll address how to get the HTTP port programmatically in...
View ArticleConditionally Run or Ignore Tests in JUnit 4
1. Overview Let's imagine we have a test for some code that depends on the Operating System and should run only if our test machine is running on Linux. If it's running on any other OS, we want the...
View Article@BeforeAll and @AfterAll in Non-Static Methods
1. Overview In this short tutorial, we're going to implement non-static methods with @BeforeAll and @AfterAll annotations available in Junit5. 2. @BeforeAll and @AfterAll in Non-Static Methods While...
View ArticleGet a List of Trusted Certificates in Java
1. Overview In this quick tutorial, we'll learn how to read a list of trusted certificates in Java through quick and practical examples. 2. Loading the KeyStore Java stores the trusted certificates in...
View ArticleReading an HTTP Response Body as a String in Java
1. Introduction In this tutorial, we'll explore several libraries for reading an HTTP response body as a string in Java. Since the first versions, Java provided the HttpURLConnection API. This includes...
View ArticleHow To Get Cookies From the Apache HttpClient Response
1. Overview In this short tutorial, we'll see how to get cookies from the Apache HttpClient response. First, we'll show how to send a custom cookie with an HttpClient request. Then, we'll see how to...
View ArticleGetting Started with jOOQ
1. Introduction In this tutorial, we're going to take a quick tour of running an application with jOOQ (Java Object Orientated Query). This library generates Java classes based on the database tables...
View ArticleJava Weekly, Issue 353
1. Spring and Java >> JEP 390: Warnings for Value-Based Classes [openjdk.java.net] One step closer to inline classes and Project Valhalla: Issue a warning when someone misuses a possible inline...
View ArticleUsing libphonenumber to Validate Phone Numbers
1. Overview In this quick tutorial, we'll see how to use Google's open-source library libphonenumber to validate phone numbers in Java. 2. Maven Dependency First, we'll need to add the dependency for...
View ArticleUsing JNA to Access Native Dynamic Libraries
1. Overview In this tutorial, we'll see how to use the Java Native Access library (JNA for short) to access native libraries without writing any JNI (Java Native Interface) code. 2. Why JNA? For many...
View ArticleChecking if a Java Class is ‘abstract’ Using Reflection
1. Overview In this quick tutorial, we'll discuss how we can check if a class is abstract or not in Java by using the Reflection API. 2. Example Class To demonstrate this, we'll create an...
View ArticleDifferences Between Netflix Feign and OpenFeign
1. Overview In this tutorial, we're going to describe the differences between Spring Cloud Netflix Feign and Spring Cloud OpenFeign. 2. Feign Feign makes writing web service clients easier by providing...
View ArticlePerforming Calculations in the Database vs. the Application
1. Overview Often, we find it difficult to decide whether a calculation should be performed in the database (RDBMS) or application code to get good performance along with convenience at the same time....
View ArticleBackground Jobs in Spring with JobRunr
1. Overview In this tutorial, we're going to look into distributed background job scheduling and processing in Java using JobRunr and have it integrate with Spring. 2. About JobRunr JobRunr is a...
View ArticleHow to Stop Execution After a Certain Time in Java
1. Overview In this article, we'll learn how we can end a long-running execution after a certain time. We'll explore the various solutions to this problem. Also, we'll cover some of their pitfalls. 2....
View ArticleWhere Does H2’s Embedded Database Store The Data?
1. Introduction In this article, we'll learn how to configure the Spring Boot application to use the embedded H2 database and then see where H2's embedded database stores the data. H2 database is a...
View ArticleJava Weekly, Issue 354
1. Spring and Java >> Shenandoah in JDK 11 – Interview With Red Hat's Team [infoq.com] Deep insights from Kennke and Shipilev about Shenandoah's history, the interaction with other JVM parts and...
View ArticleDifference Between @ComponentScan and @EnableAutoConfiguration in Spring Boot
1. Introduction In this quick tutorial, we'll learn about the differences between @ComponentScan and @EnableAutoConfiguration annotations in the Spring Framework. 2. Spring Annotations Annotations make...
View ArticleCreational Design Patterns in Core Java
1. Introduction Design Patterns are common patterns that we use when writing our software. They represent established best practices developed over time. These can then help us to ensure that our code...
View ArticleJava Weekly, Issue 355
1. Spring and Java >> Project Panama and jextract [inside.java] Explore the secure, efficient, and modern native interaction APIs from Project Panama: foreign-Memory Access API and Foreign Linker...
View Article