title: class path resource [pointsconfig.properties] cannot be opened because it does not exist
body: <p>I am trying to learn the basic of the Spring framwork. I am using the <code>org.springframework.beans.factory.config.PropertyPlaceholderConfigurer</code> in the sping.xml to print the properties of the PointA but I am getting the error below.</p>
  
  <p><strong>Triagle class</strong></p>
  
  <pre><code>package org.stack;
  
  import java.util.List;
  
  import org.springframework.beans.BeansException;
  import org.springframework.beans.factory.BeanNameAware;
  import org.springframework.beans.factory.DisposableBean;
  import org.springframework.beans.factory.InitializingBean;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.ApplicationContextAware;
  
  public class Triangle  {
      private Point PointA;
      private Point PointB;
      private Point PointC;
      private ApplicationContext context = null;
  
      public Point getPointA() {
          return PointA;
      }
  
      public void setPointA(Point pointA) {
          PointA = pointA;
      }
  
      public Point getPointB() {
          return PointB;
      }
  
      public void setPointB(Point pointB) {
          PointB = pointB;
      }
  
      public Point getPointC() {
          return PointC;
      }
  
      public void setPointC(Point pointC) {
          PointC = pointC;
      }
  
      public void draw() {
  
          System.out.println("Point A = (" + getPointA().getX() + ", "
                  + getPointA().getY() + ")");
          System.out.println("Point B = (" + getPointB().getX() + ", "
                  + getPointB().getY() + ")");
          System.out.println("Point C = (" + getPointC().getX() + ", "
                  + getPointC().getY() + ")");
  
      }
  
  }
  </code></pre>
  
  <p><strong>DrawingApp</strong></p>
  
  <pre><code>package org.stack;
  
  
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.support.AbstractApplicationContext;
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  
  
  public class DrawingApp {
  
      public static void main(String[] args) {
  
  
          AbstractApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
          context.registerShutdownHook();
          Triangle triangle =  (Triangle) context.getBean("triangle");
          triangle.draw();
  
      }
  }
  </code></pre>
  
  <p><strong>spring.xml</strong></p>
  
  
  
  <p></p>
  
  <p>
      </p>
  
  <pre><code>&lt;/bean&gt;
  
  &lt;!-- We intialize here 3 Points objects --&gt;
  &lt;bean id="pointA" class="org.stack.Point"&gt;
      &lt;property name="x" value="${PointA.pointY}" /&gt;
      &lt;property name="y" value="${PointA.pointY}" /&gt;
  &lt;/bean&gt;
  
  
  
  &lt;bean id="pointB" class="org.stack.Point"&gt;
      &lt;property name="x" value="-20" /&gt;
      &lt;property name="y" value="0" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="pointC" class="org.stack.Point"&gt;
      &lt;property name="x" value="20" /&gt;
      &lt;property name="y" value="0" /&gt;
  &lt;/bean&gt;
  
  
  &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
    &lt;property name="locations" value="pointsconfig.properties"&gt;&lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>pointsconfig.properties file</strong></p>
  
  <pre><code>PointA.pointX=0
  PointA.pointY=0
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/VAPQm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VAPQm.png" alt="enter image description here"></a></p>
  
  <p><strong>error</strong></p>
  
  <pre><code>Mai 31, 2016 1:25:24 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
  INFORMATION: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@619a5dff: startup date [Tue May 31 13:25:24 CEST 2016]; root of context hierarchy
  Mai 31, 2016 1:25:24 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  INFORMATION: Loading XML bean definitions from class path resource [spring.xml]
  Mai 31, 2016 1:25:25 PM org.springframework.beans.factory.config.PropertyPlaceholderConfigurer loadProperties
  INFORMATION: Loading properties file from class path resource [pointsconfig.properties]
  Mai 31, 2016 1:25:25 PM org.springframework.context.support.ClassPathXmlApplicationContext refresh
  WARNUNG: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [pointsconfig.properties] cannot be opened because it does not exist
  Exception in thread "main" org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [pointsconfig.properties] cannot be opened because it does not exist
      at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:89)
      at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:284)
      at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:166)
      at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:139)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:83)
      at org.stack.DrawingApp.main(DrawingApp.java:14)
  Caused by: java.io.FileNotFoundException: class path resource [pointsconfig.properties] cannot be opened because it does not exist
      at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
      at org.springframework.core.io.support.EncodedResource.getInputStream(EncodedResource.java:153)
      at org.springframework.core.io.support.PropertiesLoaderUtils.fillProperties(PropertiesLoaderUtils.java:98)
      at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:175)
      at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:156)
      at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:80)
      ... 7 more
  </code></pre>