This project demonstrates Constructor Injection with Reference Type in the Spring Framework using XML Configuration.
A Patient object depends on a Doctor object. Spring IoC Container injects the Doctor bean into the Patient bean using constructor injection and the ref attribute.
- Spring IoC Container
- XML-based Configuration
- Constructor Injection
- Reference Type Injection
- Dependency Injection
- Maven Project
- Java
- Spring Core
- Maven
- XML
SpringCore-ConstructorInjection-WithReference
│
├── src
│ └── main
│ ├── java
│ │ ├── com
│ │ │ └── configuration
│ │ │ └── application-context.xml
│ │ │
│ │ └── springcore
│ │ └── constructor_inj_with_refrence
│ │ ├── App.java
│ │ ├── Patient.java
│ │ └── Doctor.java
│ │
│ └── resources
│
├── pom.xml
├── README.md
└── .gitignore
<bean id="doctor" class="springcore.constructor_inj_with_refrence.Doctor">
<constructor-arg value="R.D. Patel"/>
<constructor-arg value="Plastic Surgery"/>
</bean>
<bean id="patient" class="springcore.constructor_inj_with_refrence.Patient">
<constructor-arg value="Prakhar"/>
<constructor-arg value="23"/>
<constructor-arg ref="doctor"/>
</bean>Patient [name=Prakhar, age=23, doctor=Doctor [doctorName=R.D. Patel, specialization=Plastic Surgery]]
- Spring IoC Container
- Dependency Injection
- Constructor Injection
- Reference Type Injection
- XML Bean Configuration
- Bean Relationships
Prakhar Panchal