Modes of Wiring (Dependency Injection) Supported by Spring Container (SC)

1. Explicit Wiring

The programmer explicitly specifies dependencies using Java code (setters, parameterized constructors, or factory methods) and XML configuration.

1.1 Constructor-Based Dependency Injection

1.2 Setter-Based Dependency Injection

1.3 Factory Method-Based Dependency Injection


2. Autowiring (Implicit Wiring)

Autowiring allows the Spring Container to automatically resolve and inject dependencies. Configured using the autowire attribute in the <bean> tag:

<bean ... autowire="no|byName|byType|constructor"/>

2.1 Autowire="byName" or "byType"