Java™

Home/Java™

Builder Design Pattern in Java with a real-world example

Builder Design Pattern solves the problem of constructing complex objects. In simple words, a situation when a class is having complex constructors or multiple numbers of parameters, it really becomes difficult to create objects in the same manner as the parameters are defined. Builder pattern solves the above problem through handling the situation by an object, rather than the multiple [...]

By |2020-01-29T06:53:04+00:00January 29th, 2020|Categories: Java™|Tags: , |

Abstract Factory Design Pattern in Java

Abstract Factory Design pattern comes under the creational patterns and it shows many similarities to the Factory Pattern. The abstract factory works as a factory of factories which generates other factories by providing an extra abstraction layer. The generated factory from an abstract factory pattern always generates the object as per the factory design pattern. In other words, We can [...]

By |2020-01-24T03:17:03+00:00January 24th, 2020|Categories: Java™|Tags: , |

Mapping and Injecting Collections in Spring

Spring Framework supports the injection of the Java Collection types List, Set, Map and Properties. You can use XML as well as annotations based configurations. We will learn Constructor, Setter, and Field injections for the collections using annotations based configurations in this article. The complete code example is available in the GitHub code repository. I recommend understanding the basics of [...]

By |2020-01-22T08:00:43+00:00January 22nd, 2020|Categories: Java™, Spring Framework|Tags: , |

Getting Started with log4j2

Introduction Hello Geeks.! This tutorial will explain the basic idea about the log4j2, it's uses and the main reasons to upgrade to log4j2 from log4j. Let's get started with the introduction of log4j2 along with the step by step implementation and configuration tuning in this log4j tutorial. 1. Architecture of log4j2 Applications using Log4j2 will request a Logger with a [...]

By |2020-01-20T13:40:51+00:00January 19th, 2020|Categories: Java™|Tags: |

Singleton Design Pattern in Java with a real-world example

Singleton works on the concept of one and only one instance of the object, which results in the global control of a resource. In simple words, the Singleton design pattern ensures that only one instance of the class will be created and that instance will have global access within the application. Singleton Design pattern is the most extensively used design [...]

By |2020-01-18T02:31:43+00:00January 18th, 2020|Categories: Java™|Tags: |

Spring bean Lifecycle Callbacks

In this article, you will learn the Spring bean lifecycle and different ways to run bean initialization callbacks and bean destruction callbacks. Bean lifecycle simply means you want to execute callbacks before the spring bean is available to use and similarly execute callbacks before the bean is destroyed. There are several ways to configure the Spring bean lifecycle callbacks as [...]

By |2020-01-17T08:06:57+00:00January 17th, 2020|Categories: Java™, Spring Framework|Tags: , , |

Factory Design Pattern in Java with a real-world example

The Factory design pattern is a part of the creational design pattern. It works on the concept of Encapsulation by hiding the object's instantiation logic from the client. The factory Design pattern is the second most used design pattern in the creational patterns category, after the singleton pattern. The factory pattern is just opposite to the concept of the singleton [...]

By |2020-01-14T02:59:00+00:00January 14th, 2020|Categories: Java™|Tags: |

Spring Bean Scopes – @Scope annotation

In this article, you will learn about Spring Bean Scopes using @Scope annotation and XML configurations. If you are new to Spring, make sure you understand Dependency Injection in Spring. Creating a bean means, you create the actual instance of the class with the dependencies injected based on the bean definition. Bean definition is like a recipe, you can create [...]

By |2020-01-13T07:45:33+00:00January 13th, 2020|Categories: Java™, Spring Framework|Tags: , |

Inversion of Control and Dependency Injection in Spring

Inversion of Control (IoC) and Dependency Injection (DI) are programming patterns for decoupling the Class dependencies. In this article, we will talk about IoC and DI with respect to Spring Framework. Read High Level introduction of Spring Framework if you are new to Spring. 1. What is Inversion of Control (IoC)? For simplicity, let's say class Vehicle is dependent on [...]

By |2020-01-08T07:49:28+00:00January 8th, 2020|Categories: Java™, Spring Framework|Tags: , , , |

A high-level introduction to Spring Framework

What is the Spring Framework? The age-old answer to this question is, "Spring is a Dependency Injection Framework". In reality, it is much more than that. Spring is the most popular Java Enterprise application development framework, it comes with many tools and libraries to solve almost any problem in the java world. May it be microservices or a simple database-driven [...]

By |2020-01-04T12:45:16+00:00January 4th, 2020|Categories: Java™, Spring Framework|Tags: , |