title: why does Spring use XML for component wiring?
body: <p>I understand the IOC concept, which we can mix-and-match different classes using wiring.
  Every class can get away from hard code it's dependancy by delegating the wiring / relationship handling to base xml (context xml).</p>
  
  <p>Here is my question, why do we use xml? we can simply wire all the components by using java class.
  Instead of</p>
  
  <pre><code>&lt;bean id="helloWorld" class="com.vaannila.HelloWorld"&gt;
      &lt;property name="message" value="HelloWorld"&gt;&lt;/property&gt;
  &lt;/bean&gt;
  
  public static void main(String[] args)
  {
      // TODO Auto-generated method stub
      ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
      HelloWorld helloWorld = (HelloWorld) context.getBean("helloWorld");
      helloWorld.display();
  }
  </code></pre>
  
  <p>We can rewrite them using</p>
  
  <pre><code>HelloWorld helloWorld = new HelloWorld();
  helloWorld.setMessage("HelloWorld");
  helloWorld.display();   
  </code></pre>