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.




Ready for structured training?

Learn Java Full Stack with real projects

Live classes, practical projects, interview preparation and placement support in one guided programme.

View Java Full Stack Course Book Free Demo