title: NoSuchBeanDefinitionException: No bean named 'triangle' is defined
body: <p>I am new to spring. I am getting </p>
  
  <blockquote>
    <p>NoSuchBeanDefinitionException: No bean named 'triangle' is defined</p>
  </blockquote>
  
  <p>with a simple java app.</p>
  
  <p>I am getting the following Error Msg</p>
  
  <pre><code>Jul 20, 2014 7:44:44 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
  INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@383118: startup date [Sun Jul 20 07:44:44 EDT 2014]; root of context hierarchy
  Jul 20, 2014 7:44:44 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
  INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@47eaec: defining beans []; root of factory hierarchy
  Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'Triangle' is defined
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:570)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1108)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:278)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
      at com.springDemo.main.DrawingApp.main(DrawingApp.java:22)
  </code></pre>
  
  <p>my contextBean.xml </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd"&gt;
  
      &lt;bean id="triangle"  class="com.springDemo.main.Triangle1" &gt;
          &lt;property name="type" value="Equilateral" /&gt; 
      &lt;/bean &gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>DrawingApp.java</p>
  
  <pre><code>package com.springDemo.main;
  
  import org.springframework.core.io.*;
  import org.springframework.beans.factory.BeanFactory;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  
  public class DrawingApp {
  
      private static ApplicationContext context;
  
      static String[] springConfig  = 
      {   
          "classpath::*/com/springDemo/main/contextBean.xml"           
      };
  
      public static void main(String[] args)
      {
  
          context = new ClassPathXmlApplicationContext(springConfig);
          Triangle triangle =( Triangle )context.getBean("triangle");
          triangle.draw();
      }
  }
  </code></pre>