title: @Resource annotation applied on setter method is returning the null pointer exception when using getter method to get the value
body: <p>I have a simple class called circle which has a property called center,  I have a simple class called circle which has a property called center, on which i have applied @Resource annotation to inject the dependency from spring.xml but somehow the center value is not injecting from spring.xml that is why i am getting null pointer exception while getting the value.
  i have a bean defined in xml  with the same name as the name of property of circle</p>
  
  <pre><code>
       //Circle class:
  
          package org.devesh.learning.spring;
  
          import javax.annotation.Resource;
  
          import org.springframework.beans.factory.annotation.Autowired;
          import org.springframework.beans.factory.annotation.Qualifier;
  
  public class Circle implements Shape {
  
      private Point center; 
  
      @Override
      public void draw() {
  
        System.out.println("Circle drawn");
        System.out.println("Circle center is : "+ center.getX() + "," + center.getY());       
      }
  
      public Point getCenter() {
          return center;
      }
  
      //@Autowired
      //@Qualifier("circle related")
      @Resource
      public void setCenter(Point center) {
          this.center = center;
      }
  
  }
  
  
  Point class:
  
  package org.devesh.learning.spring;
  
  public class Point {
  
      private int x;
      private int y;
  
  
      public int getX() {
          return x;
      }
      public void setX(int x) {
          this.x = x;
      }
      public int getY() {
          return y;
      }
      public void setY(int y) {
          this.y = y;
      }
  
  
  
  }
  
  spring.xml:
  
  &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 https://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/context/spring-context-3.2.xsd
           https://www.springframework.org/schema/context/spring-context-3.2.xsd"
      xmlns:context="http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt;
  
       &lt;bean id="circle" class="org.devesh.learning.spring.Circle"&gt;
       &lt;/bean&gt;
  
         &lt;bean id ="pointA"  class="org.devesh.learning.spring.Point"&gt;
        &lt;property name="x" value="${pointA.pointX}"&gt;&lt;/property&gt;
        &lt;property name="y" value="${pointA.pointY}"&gt;&lt;/property&gt; 
    &lt;/bean&gt;
  
  
     &lt;bean id = "center" class="org.devesh.learning.spring.Point"&gt; 
        &lt;property name="x" value="20"&gt;&lt;/property&gt;
        &lt;property name="y" value="0"&gt;&lt;/property&gt; 
    &lt;/bean&gt;
  
  
    &lt;bean id = "pointC" class="org.devesh.learning.spring.Point"&gt;
        &lt;property name="x" value="-20"&gt;&lt;/property&gt;
        &lt;property name="y" value="0"&gt;&lt;/property&gt; 
    &lt;/bean&gt;
  
     &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
     &lt;property name="locations" value="pointconfig.properties"&gt;&lt;/property&gt;  
   &lt;/bean&gt;
  
  
  
  &lt;/beans&gt;  
  </code></pre>