Understanding Constructor injection by XML configuration

Let’s say we have a parameterized constructor in student class. Bean creation will be failed. See example below.

Merchant.java


Config file – remove autowiring tag from this xml


Client.java


Error on console


To solve this we will change implementation as below.

Config file – remove autowiring tag from this xml and add below lines.




Need guided training for this topic?

Learn with mentors, projects, mock interviews, and placement support at The Kiran Academy.

Explore Courses Book Free Demo