title: Instantiation of class - Spring framework
body: <p>In the below code,</p>
  
  <p>1)
  Create &amp; initiate a new <strong>dependency container</strong> of implementation class(not yet instantiated). <code>appContext</code> gets the handle of that container.</p>
  
  <pre><code>ApplicationContext appContext = new ClassPathXmlApplicationContext("Springbeans.xml");
  </code></pre>
  
  <p>2) Instantiate a class(with id <code>messagebean</code>), which is called bean. Using <strong>service locator pattern</strong> <code>mBean</code> gets the handle of that instance from the container.</p>
  
  <pre><code>MessageBean mBean = (MessageBean)appContext.getBean("messagebean"); 
  </code></pre>
  
  <p>3) 
  Destroy all beans and close the dependency container.</p>
  
  <pre><code>(ConfigurableApplicationContext)appContext.close(); 
  </code></pre>
  
  <hr>
  
  <p>Below is the <code>messagebean</code> definition in <code>Springbeans.xml</code></p>
  
  <pre><code>&lt;beans ...&gt;
      &lt;bean id="messagebean" class="com.xyz.spring.MessageBean"&gt;
        &lt;property name="message" value="hello" /&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <hr>
  
  <p>As per above understanding, Does implementation(<code>messagebean</code>) get instantiated after executing <code>getBean()</code>?</p>