Managing Bean Registration in a Spring Container

Missing Bean Detection A class marked with @Component may still be unavailable during autowiring if the Spring context does not scan its package. Consider the following class: @Component public class Calculator { public int add() { return 42; } } Attempting to inject it in a test without proper container configuration will resu ...

Posted on Mon, 05 Oct 2026 16:21:54 +0000 by fighnight

Understanding Spring Bean Lifecycle with Practical Examples

Introduction In this article, we'll explore the lifecycle of a Spring bean through hands-on coding examples. Understanding bean lifecycle is crucial in Spring framework as it helps in managing bean initialization, configuration, and destruction effective. Implementing Lifecycle Interfaces We'll create a class that implements several Spring life ...

Posted on Thu, 01 Oct 2026 16:42:09 +0000 by chrisC

Understanding Spring IOC and Bean Management

Spring IOC Inversion of Control transfers the responsibility of object creation, initialization, and destruction to the Spring container, which manages the complete lifecycle of objects. Initializing the Spring Container Classpath-based configurasion The XML configuration file must reside within the classpath: ApplicationContext context = new C ...

Posted on Tue, 29 Sep 2026 17:00:30 +0000 by KMC1499

Building a Simple XML-based Bean Container in Java

Abstratc Bean Definition Reader The AbstractBeanDefinitionReader acts as a base class for all bean definition readers. It provides common functionality, such as resource loading, and defines a template method that concrete readers must implement to perform the actual parsing of configuration data. It delegates the storage of parsed bean definit ...

Posted on Fri, 25 Sep 2026 16:39:23 +0000 by Dread

Creating a Simple Spring Application with Dependency Injection

Basic Hello World Implementation Create a simple POJO class with a string property: public class Greeting { private String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } @Override public String toString() { ...

Posted on Tue, 22 Sep 2026 16:27:05 +0000 by SyndicatE

Introduction to Unity Dependency Injection

Unity is a lightweight and extensible dependency injection (DI) container developed by Microsoft's Patterns & Practices team. It supports three common DI modes: Constructor Injection, Property Injection, and Method Call Injection. The latest version, 1.2, can be downloaded from the Microsoft open-source site at Unity Codeplex. By using Unit ...

Posted on Fri, 18 Sep 2026 16:13:49 +0000 by Chantal

Spring 6 IoC Container Deep Dive

IoC Container Inversion of Control The IoC container serves as the practical implementation of the IoC design pattern in Spring. Components managed by the IoC container are referred to as beans. Before creating a bean, the IoC container must be instantiated first. Spring provides two primary implementations: ① BeanFactory The fundamental implem ...

Posted on Thu, 17 Sep 2026 16:55:10 +0000 by Travis Estill

Dependency Injection in .NET Core Using Autofac

Official Documentation https://autofaccn.readthedocs.io/zh/latest/index.html Creating a .NET Core Console Application Registering Types – Example One Define an interface IPerson public interface IPerson { void Introduce(); } Implemant the interface with a Worker class public class Worker : IPerson { public void Introduce() { ...

Posted on Fri, 11 Sep 2026 16:39:24 +0000 by Brad420

Spring Source Analysis: Bean Lifecycle (Part 3)

In previous articles, we've covered the foundational steps for bean preparation, including bean definition processing and FactoryBean identification. Building upon this knowledge, we can now dive deeper into the implementation logic of the getBean method and gain better insights into how the createBean method works. Usage of getBean Before divi ...

Posted on Fri, 11 Sep 2026 16:31:00 +0000 by nihal

Implementing Dependency Injection in Spring: Setter vs. Constructor Injection

Dependency Injection (DI) is a core pattern where an object's dependencies are provided externally rather than the object creating them itself. Constructor Injection involves providing dependencies through a class's constructor at the time of object creation. This ensures the object is fully initialized and immutable if dependencies are declare ...

Posted on Sat, 05 Sep 2026 16:44:54 +0000 by andrewgauger