Spring do provide IOC through Dependency Injection either with Setter Injection or Constructor Injection, with a aim to avoid TightCoupling and enforce LooseCoupling. In tight coupling, one object is heavily dependent on other object like as below.
Lets try attempt to reduce the impact of tight coupled Travel & Car object
Now Spring did it through XML bean configurations .... as below
spring.xml Configuration :
I can define any vehcile in the xml , ie a Train/Aeroplane/Cruise/Horse/Camel............