Single Responsibility Principle in Java
1. Overview In this tutorial, we'll be discussing the Single Responsibility Principle, as one of the SOLID principles of object-oriented programming. Overall, we'll go in-depth on what this principle...
View ArticleBuilding a Java Application With Gradle
1. Overview This tutorial provides a practical guide on how to build a Java-based project using Gradle. We'll explain the steps of manually creating a project structure, performing the initial...
View ArticleAsserting Log Messages With JUnit
1. Introduction In this tutorial, we'll look at how we can cover generated logs in JUnit testing. We'll use the slf4j-api and the logback implementation and create a custom appender that we can use for...
View ArticleHow to add proxy support to Jsoup?
1. Overview In this tutorial, we'll take a look at how to add proxy support to Jsoup. 2. Common Reasons To Use a Proxy There are two main reasons we might want to use a proxy with Jsoup. 2.1. Usage...
View ArticleSpring JPA @Embedded and @EmbeddedId
1. Overview In this tutorial, we're going to cover the use of the @EmbeddedId annotation and “findBy” method for querying a composite key based JPA entity. Hence we'll be using @EmbeddeId and...
View ArticleCopying Files To And From Docker Containers
1. Introduction As more of our applications are deployed to cloud environments, working with Docker is becoming a necessary skill for developers. Often when debugging applications, it is useful to copy...
View ArticleGenerate Database Schema with Spring Data JPA
1. Overview When creating a persistence layer, we need to match our SQL database schema with the object model that we have created in our code. This can be a lot of work to do manually. In this...
View ArticleManual Logout With Spring Security
1. Introduction Spring Security is the standard for securing Spring-based applications. It has several features to manage user's authentication, including login and logout. In this tutorial, we'll...
View ArticleFind Unused Maven Dependencies
1. Overview When using Maven to manage our project dependencies, we can lose track of what dependencies are used in our application. In this short tutorial, we'll cover how to use the Maven dependency...
View ArticleHow to Set Environment Variables in Jenkins?
1. Introduction In this tutorial, we'll show the different ways to set and use environment variables in Jenkins. To learn more about Jenkins and Pipelines, refer to our intro to Jenkins. 2. Global...
View ArticleSpring Data Redis’s Property-Based Configuration
1. Overview One of the main attractions of Spring Boot is how it often reduces third-party configuration to just a few properties. In this tutorial, we're going to see how Spring Boot simplifies...
View ArticleJava Weekly, Issue 332
1. Spring and Java >> Updates to Spring Versions [spring.io] The Spring team is adopting Semantic Versioning for project modules, and Calendar Versioning for release trains. >> Java Feature...
View ArticleSpring Cloud Gateway WebFilter Factories
1. Introduction Spring Cloud Gateway is an intelligent proxy service often used in microservices. It transparently centralizes requests in a single entry point and routes them to the proper service....
View ArticleHow to dynamically Autowire a Bean in Spring
1. Introduction In this short tutorial, we'll show how to dynamically autowire a bean in Spring. We'll start by presenting a real-world use case where dynamic autowiring might be helpful. In addition...
View ArticleSpring Security With Okta
1. Overview Okta provides features like authentication, authorization, and social login for web, mobile, or API services. Additionally, it has robust support for the Spring Framework to make...
View ArticleLogout in an OAuth Secured Application (using the Spring Security OAuth...
1. Overview In this quick tutorial, we're going to show how we can add logout functionality to an OAuth Spring Security application. We will, of course, use the OAuth application described in a...
View ArticleValidate Phone Numbers With Java Regex
1. Overview Sometimes, we need to validate text to ensure that its content complies with some format. In this quick tutorial, we'll see how to validate different formats of phone numbers using regular...
View ArticleForeign Memory Access API in Java 14
1. Overview Java objects reside on the heap. However, this can occasionally lead to problems such as inefficient memory usage, low performance, and garbage collection issues. Native memory can be more...
View ArticleLog4j 2 Plugins
1. Overview Log4j 2 uses plugins like Appenders and Layouts to format and output logs. These are known as core plugins, and Log4j 2 provides a lot of options for us to choose from. However, in some...
View ArticleTransactional Annotations: Spring vs. JTA
1. Overview In this tutorial, we'll discuss the differences between org.springframework.transaction.annotation.Transactional and javax.transaction.Transactional annotations. We'll start with an...
View Article