Your xml file is like an application configuration file (app.config
), but when using an an XmlApplicationContext
like you do, it should be a plain xml file, see for instance this example of a plain xml configuration file.
Basically, your XMLFile1.xml
should be something like:
<objects xmlns="http://www.springframework.net">
<object name="MyCar"
type="ConsoleApplicationApring.Car, ConsoleApplicationApring" >
</object>
</objects>
This documented in section 5.2.2 of the docs.